Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Improve codesandbox generation logic #22221

Merged
merged 2 commits into from Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/src/modules/utils/helpers.js
Expand Up @@ -77,11 +77,9 @@ function includePeerDependencies(deps, versions) {
Object.assign(deps, {
'react-dom': versions['react-dom'],
react: versions.react,
'@material-ui/core': versions['@material-ui/core'],
});

if (deps['@material-ui/lab'] && !deps['@material-ui/core']) {
deps['@material-ui/core'] = versions['@material-ui/core'];
}
if (deps['@material-ui/pickers'] && !deps['date-fns']) {
deps['date-fns'] = 'latest';
}
Expand All @@ -108,7 +106,7 @@ function getDependencies(raw, options = {}) {
'@material-ui/styles': 'next',
'@material-ui/system': 'next',
'@material-ui/utils': 'next',
// TODO: Remove once v4 is stable
// TODO: Remove, moving into the lab
'@material-ui/pickers': 'next',
};

Expand Down
3 changes: 2 additions & 1 deletion docs/src/modules/utils/helpers.test.js
Expand Up @@ -114,13 +114,14 @@ import {

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

it('should include core if lab present', () => {
it('should always include core', () => {
const source = `
import lab from '@material-ui/lab';
`;
Expand Down