Skip to content

Commit

Permalink
Merge pull request mui#727 from dmtrKovalenko/lerna
Browse files Browse the repository at this point in the history
[RFC] Move utils to separate package + Lerna
  • Loading branch information
dmtrKovalenko authored Oct 31, 2018
2 parents cee2b91 + d3459e4 commit 03fadb0
Show file tree
Hide file tree
Showing 45 changed files with 17,771 additions and 9,321 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# dependencies
*/node_modules
node_modules

# build
dist
Expand All @@ -23,7 +23,7 @@ coverage
.eslintcache

# dotenv environment variables file
.env
.env.local

# webstorm
.idea/
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions docs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PORT="3002"
NODE_PATH="src/"
21 changes: 0 additions & 21 deletions docs/.gitignore

This file was deleted.

18,699 changes: 11,176 additions & 7,523 deletions docs/package-lock.json

Large diffs are not rendered by default.

63 changes: 18 additions & 45 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,18 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@date-io/core": "0.0.1",
"@date-io/date-fns": "0.0.1",
"@date-io/luxon": "0.0.1",
"@date-io/moment": "0.0.1",
"@material-ui/core": "^3.3.1",
"autoprefixer": "7.1.6",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "^8.0.4",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"classnames": "^2.2.6",
"css-loader": "0.28.7",
"date-fns": "2.0.0-alpha.16",
"dotenv": "4.0.0",
"dotenv-expand": "4.2.0",
"eslint-config-react-app": "^2.1.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"fs-extra": "3.0.1",
"history": "^4.7.2",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"jss": "^9.8.7",
"jss-preset-default": "^4.5.0",
"jss-rtl": "^0.2.3",
"luxon": "^1.4.0",
"material-ui-pickers": "^1.0.1",
"material-ui-pickers-jalali-utils": "^0.4.3",
"moment": "^2.22.2",
"moment-jalaali": "^0.7.4",
Expand All @@ -44,7 +25,7 @@
"prismjs": "^1.15.0",
"promise": "8.0.1",
"prop-types": "^15.6.2",
"raf": "3.4.0",
"raw-loader": "^0.5.1",
"react": "^16.5.2",
"react-dev-utils": "^5.0.2",
"react-docgen": "^2.21.0",
Expand All @@ -53,29 +34,15 @@
"react-markdown": "^2.5.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-transition-group": "^2.5.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.6.2",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4",
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3"
"react-scripts": "^2.0.5",
"style-loader": "0.19.0"
},
"devDependencies": {
"cross-env": "^5.2.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-import-resolver-webpack": "^0.8.4",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1",
"raw-loader": "^0.5.1"
"cross-env": "^5.2.0"
},
"scripts": {
"start": "cross-env PORT=3002 node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom",
"start": "react-scripts start",
"build": "react-scripts build",
"docs:generate": "react-docgen ../lib/src --out prop-types.json --resolver findAllComponentDefinitions --pretty",
"backers:generate": "node scripts/generate-backers",
"deploy": "npm run docs:generate && npm run backers:generate && npm run build && firebase deploy"
Expand Down Expand Up @@ -116,5 +83,11 @@
},
"eslintConfig": {
"extends": "react-app"
}
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
1 change: 0 additions & 1 deletion docs/patrons.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/scripts/generate-backers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ patreonAPIClient('/campaigns/1559688/pledges')

return user.attributes;
}))
.then(users => fse.writeFile(path.resolve(__dirname, '..', 'patrons.json'), JSON.stringify(users)));
.then(users => fse.writeFile(path.resolve(__dirname, '..', 'src', 'patrons.json'), JSON.stringify(users)));
2 changes: 1 addition & 1 deletion docs/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core';

import Utils from 'material-ui-pickers/utils/date-fns-utils';
import Utils from '@date-io/date-fns';
import { MuiPickersUtilsProvider } from 'material-ui-pickers';

import { create } from 'jss';
Expand Down
8 changes: 4 additions & 4 deletions docs/src/Examples/CodeSnippets/MuiPickerProviderCode.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable */
import MuiPickersUtilsProvider from 'material-ui-pickers/MuiPickersUtilsProvider';
import { MuiPickersUtilsProvider } from 'material-ui-pickers';
// pick utils
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils';
import LuxonUtils from 'material-ui-pickers/utils/luxon-utils';
import MomentUtils from '@date-io/moment';
import DateFnsUtils from '@date-io/date-fns';
import LuxonUtils from '@date-io/luxon';

function App() {
return (
Expand Down
35 changes: 13 additions & 22 deletions docs/src/Examples/CodeSnippets/QuickStart.jsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
import React, { PureComponent } from 'react';
import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils';
import MuiPickersUtilsProvider from 'material-ui-pickers/MuiPickersUtilsProvider';
import TimePicker from 'material-ui-pickers/TimePicker';
import DatePicker from 'material-ui-pickers/DatePicker';
import DateTimePicker from 'material-ui-pickers/DateTimePicker';
import React, { PureComponent } from "react";
import DateFnsUtils from "@date-io/date-fns";
import { MuiPickersUtilsProvider } from "material-ui-pickers";
import { TimePicker } from "material-ui-pickers";
import { DatePicker } from "material-ui-pickers";
import { DateTimePicker } from "material-ui-pickers";

export default class App extends PureComponent {
state = {
selectedDate: new Date(),
}
selectedDate: new Date()
};

handleDateChange = (date) => {
handleDateChange = date => {
this.setState({ selectedDate: date });
}
};

render() {
const { selectedDate } = this.state;

return (
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<DatePicker
value={selectedDate}
onChange={this.handleDateChange}
/>
<DatePicker value={selectedDate} onChange={this.handleDateChange} />

<TimePicker
value={selectedDate}
onChange={this.handleDateChange}
/>
<TimePicker value={selectedDate} onChange={this.handleDateChange} />

<DateTimePicker
value={selectedDate}
onChange={this.handleDateChange}
/>
<DateTimePicker value={selectedDate} onChange={this.handleDateChange} />
</MuiPickersUtilsProvider>
);
}
Expand Down
22 changes: 11 additions & 11 deletions docs/src/Examples/Guides/OverrideFormatPicker.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import format from 'date-fns/format';
import frLocale from 'date-fns/locale/fr';
import { DatePicker } from 'material-ui-pickers';
import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils';
import MuiPickersUtilsProvider from 'material-ui-pickers/MuiPickersUtilsProvider';
import React, { PureComponent } from 'react';
import format from "date-fns/format";
import frLocale from "date-fns/locale/fr";
import { DatePicker } from "material-ui-pickers";
import DateFnsUtils from "@date-io/date-fns";
import { MuiPickersUtilsProvider } from "material-ui-pickers";
import React, { PureComponent } from "react";

class LocalizedUtils extends DateFnsUtils {
getDatePickerHeaderText(date) {
return format(date, 'd MMM YYYY', { locale: this.locale });
return format(date, "d MMM YYYY", { locale: this.locale });
}
}

export default class DateFnsLocalizationExample extends PureComponent {
state = {
selectedDate: new Date(),
}
selectedDate: new Date()
};

handleDateChange = (date) => {
handleDateChange = date => {
this.setState({ selectedDate: date });
}
};

render() {
const { selectedDate } = this.state;
Expand Down
122 changes: 59 additions & 63 deletions docs/src/Examples/Guides/StaticPickers.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,59 @@
import React, { PureComponent } from 'react';
import Paper from '@material-ui/core/Paper';

// Make sure that for using static pickers you use path imports
import BasePicker from 'material-ui-pickers/_shared/BasePicker';
import Calendar from 'material-ui-pickers/DatePicker/components/Calendar';
import TimePickerView from 'material-ui-pickers/TimePicker/components/TimePickerView';
import MuiPickersUtilsProvider from 'material-ui-pickers/MuiPickersUtilsProvider';
import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils';

/* eslint-disable no-unused-vars */
class StaticPickers extends PureComponent {
state = {
selectedDate: new Date(),
}

handleDateChange = (date) => {
this.setState({ selectedDate: date });
}

render() {
const { selectedDate } = this.state;

return (
// Also important to use path import for provider
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<BasePicker value={selectedDate} onChange={this.handleDateChange}>
{
({
date,
handleAccept,
handleChange,
handleClear,
handleDismiss,
handleSetTodayDate,
handleTextFieldChange,
pick12hOr24hFormat,
}) => (
<div>
<div className="picker">
<Paper style={{ overflow: 'hidden' }}>
<Calendar date={date} onChange={handleChange} />
</Paper>
</div>

<TimePickerView
date={date}
ampm={false}
onHourChange={handleChange}
type="hours"
/>
</div>
)
}
</BasePicker>
</MuiPickersUtilsProvider>
);
}
}


export default StaticPickers;

// import React, { PureComponent } from "react";
// import Paper from "@material-ui/core/Paper";

// // Make sure that for using static pickers you use path imports
// import BasePicker from "material-ui-pickers/_shared/BasePicker";
// import Calendar from "material-ui-pickers/DatePicker/components/Calendar";
// import TimePickerView from "material-ui-pickers/TimePicker/components/TimePickerView";
// import MuiPickersUtilsProvider from "material-ui-pickers/MuiPickersUtilsProvider";
// import DateFnsUtils from "material-ui-pickers/utils/date-fns-utils";

// /* eslint-disable no-unused-vars */
// class StaticPickers extends PureComponent {
// state = {
// selectedDate: new Date()
// };

// handleDateChange = date => {
// this.setState({ selectedDate: date });
// };

// render() {
// const { selectedDate } = this.state;

// return (
// // Also important to use path import for provider
// <MuiPickersUtilsProvider utils={DateFnsUtils}>
// <BasePicker value={selectedDate} onChange={this.handleDateChange}>
// {({
// date,
// handleAccept,
// handleChange,
// handleClear,
// handleDismiss,
// handleSetTodayDate,
// handleTextFieldChange,
// pick12hOr24hFormat
// }) => (
// <div>
// <div className="picker">
// <Paper style={{ overflow: "hidden" }}>
// <Calendar date={date} onChange={handleChange} />
// </Paper>
// </div>

// <TimePickerView
// date={date}
// ampm={false}
// onHourChange={handleChange}
// type="hours"
// />
// </div>
// )}
// </BasePicker>
// </MuiPickersUtilsProvider>
// );
// }
// }

// export default StaticPickers;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react';
import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils';
import DateFnsUtils from '@date-io/date-fns';
import { Icon, IconButton, Menu, MenuItem } from '@material-ui/core';
import { DatePicker, MuiPickersUtilsProvider } from 'material-ui-pickers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import moment from 'moment';
import 'moment/locale/fr';
import 'moment/locale/ru';
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import MomentUtils from '@date-io/moment';
import { Icon, IconButton, Menu, MenuItem } from '@material-ui/core';
import { DatePicker, MuiPickersUtilsProvider } from 'material-ui-pickers';

Expand Down
Loading

0 comments on commit 03fadb0

Please sign in to comment.