-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6122fc
commit 9878669
Showing
5 changed files
with
69 additions
and
54 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
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,29 @@ | ||
const getGithubProjectUrl = require('./getGithubProjectUrl'); | ||
const dependentProjectsAnalysis = require('../../../dependent-usage.json'); | ||
|
||
const { | ||
projectUsages: dependentProjectsUsages, | ||
} = dependentProjectsAnalysis; | ||
|
||
const componentsUsage = dependentProjectsUsages | ||
.reduce((accumulator, project) => { | ||
Object.keys(project.usages).forEach(componentName => { | ||
// The next line is necessary for the same naming of the components both in the file with the | ||
// repositories of use and in the data structures GraphQL. | ||
const newComponentName = componentName.replace(/\./g, ''); | ||
if (!accumulator[newComponentName]) { | ||
accumulator[newComponentName] = []; | ||
} | ||
accumulator[newComponentName] = accumulator[newComponentName].concat({ | ||
name: project.name, | ||
folderName: project.folderName, | ||
version: project.version, | ||
repositoryUrl: getGithubProjectUrl(project.repository), | ||
componentUsageCount: project.usages[componentName].length, | ||
usages: project.usages[componentName], | ||
}); | ||
}); | ||
return accumulator; | ||
}, {}); | ||
|
||
module.exports = componentsUsage; |
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