Skip to content

Commit

Permalink
Fixed peer dependencies in download page (#1491)
Browse files Browse the repository at this point in the history
Update the download page to properly order components when they have
peer dependencies.
  • Loading branch information
RunDevelopment authored and mAAdhaTTah committed Jul 22, 2018
1 parent b1c2f4d commit 9d15ff6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions download.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ for (var category in components) {
enabled: checked,
require: $u.type(all[id].require) === 'string' ? [all[id].require] : all[id].require,
after: $u.type(all[id].after) === 'string' ? [all[id].after] : all[id].after,
peerDependencies: $u.type(all[id].peerDependencies) === 'string' ? [all[id].peerDependencies] : all[id].peerDependencies,
owner: all[id].owner,
files: {
minified: {
Expand Down Expand Up @@ -465,8 +466,8 @@ function getSortedComponents(components, requireName, sorted) {
return sorted;
}

function getSortedComponentsByRequirements(components){
var sorted = getSortedComponents(components, "after");
function getSortedComponentsByRequirements(components, afterName) {
var sorted = getSortedComponents(components, afterName);
return getSortedComponents(components, "require", sorted);
}

Expand All @@ -478,7 +479,7 @@ function generateCode(){
var all = components[category];

// In case if one component requires other, required component should go first.
var sorted = getSortedComponentsByRequirements(all);
var sorted = getSortedComponentsByRequirements(all, category === 'languages' ? 'peerDependencies' : 'after');

for (var i = 0; i < sorted.length; i++) {
var id = sorted[i];
Expand Down

0 comments on commit 9d15ff6

Please sign in to comment.