Skip to content

Commit

Permalink
[docs] Improve codesandbox generation logic (#22221)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 16, 2020
1 parent da585a9 commit deafe43
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/src/modules/utils/helpers.js
Expand Up @@ -79,9 +79,27 @@ function includePeerDependencies(deps, versions) {
react: versions.react,
});

if (deps['@material-ui/lab'] && !deps['@material-ui/core']) {
if (
deps['@material-ui/lab'] ||
deps['@material-ui/pickers'] ||
deps['@material-ui/x'] ||
deps['@material-ui/x-grid'] ||
deps['@material-ui/x-pickers'] ||
deps['@material-ui/x-tree-view'] ||
deps['@material-ui/data-grid']
) {
deps['@material-ui/core'] = versions['@material-ui/core'];
}

if (deps['@material-ui/x-data-grid-generator']) {
deps['@material-ui/core'] = versions['@material-ui/core'];
deps['@material-ui/icons'] = versions['@material-ui/icons'];
deps['@material-ui/lab'] = versions['@material-ui/lab'];
}

if (deps['@material-ui/pickers']) {
deps['date-fns'] = 'latest';
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions docs/src/modules/utils/helpers.test.js
Expand Up @@ -116,6 +116,7 @@ import {

expect(getDependencies(source)).to.deep.equal({
'date-fns': 'latest',
'@material-ui/core': 'latest',
'@material-ui/pickers': 'latest',
react: 'latest',
'react-dom': 'latest',
Expand Down

0 comments on commit deafe43

Please sign in to comment.