-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
relay-example: Get transpile workspaces programatically
- Loading branch information
1 parent
a74bc86
commit e565bb0
Showing
4 changed files
with
36 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// @flow | ||
|
||
const { spawnSync } = require('child_process'); | ||
|
||
/** | ||
* This should probably have been a part of @adeira/monorepo-utils, | ||
* but it is difficult to make it run in next.config.js because of our setup. | ||
* Maybe when we have migrated to bazel, we can move this to monorepo-utils | ||
*/ | ||
function getTranspileWorkspaces() /* : $ReadOnlyArray<string> */ { | ||
const workspaces = JSON.parse( | ||
JSON.parse(spawnSync('yarn', ['workspaces', '--json', 'info']).stdout.toString()).data, | ||
); | ||
|
||
const transpileWorkspaces = new Set(); | ||
|
||
const getWorkspaces = (workspace = '@adeira/example-relay') => { | ||
for (const dependency of workspaces[workspace].workspaceDependencies) { | ||
transpileWorkspaces.add(dependency); | ||
getWorkspaces(dependency); | ||
} | ||
}; | ||
|
||
getWorkspaces(); | ||
return Array.from(transpileWorkspaces); | ||
} | ||
|
||
module.exports = getTranspileWorkspaces; |
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