From 5080c661ec5c2e499f9f2c7cb6590bb2c1e39143 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 24 Oct 2018 13:52:21 +0900 Subject: [PATCH] Upgrade to babel7; Add support of next@v7; --- .babelrc | 14 ++-- .babelrc.dev | 1 - .babelrc.prod | 14 ++-- .eslintrc | 4 +- .gitignore | 2 +- CHANGELOG.md | 68 +++++++++++++++++++ .../src/client/layout/CommonLayout.js | 2 +- examples/withTheme/src/client/style/theme.js | 3 + .../src/client/layout/CommonLayout.js | 2 +- .../withThemeApp/src/client/style/theme.js | 3 + jest.config.js | 2 +- jsconfig.json | 5 +- package.json | 43 ++++++------ src/mui/defaultTheme.js | 15 ++-- src/nextjs/extendsWithMui.js | 1 + 15 files changed, 124 insertions(+), 55 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.babelrc b/.babelrc index d358b61..8e4948e 100644 --- a/.babelrc +++ b/.babelrc @@ -1,18 +1,16 @@ { "presets": [ - "env", - "react" + "@babel/env", + "@babel/react" ], "plugins": [ "add-module-exports", - "transform-class-properties", - "transform-object-rest-spread", - "react-require", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-object-rest-spread", [ - "transform-runtime", + "@babel/plugin-transform-runtime", { "helpers": false, - "polyfill": false, "regenerator": true } ], @@ -20,7 +18,7 @@ "module-resolver", { "root": [ - "./src/" + "./src" ], "alias": { "material-ui": "@material-ui/core", diff --git a/.babelrc.dev b/.babelrc.dev index 0ade1c6..1bed7ad 100644 --- a/.babelrc.dev +++ b/.babelrc.dev @@ -3,7 +3,6 @@ "next/babel" ], "plugins": [ - "react-require", [ "module-resolver", { diff --git a/.babelrc.prod b/.babelrc.prod index d358b61..8e4948e 100644 --- a/.babelrc.prod +++ b/.babelrc.prod @@ -1,18 +1,16 @@ { "presets": [ - "env", - "react" + "@babel/env", + "@babel/react" ], "plugins": [ "add-module-exports", - "transform-class-properties", - "transform-object-rest-spread", - "react-require", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-object-rest-spread", [ - "transform-runtime", + "@babel/plugin-transform-runtime", { "helpers": false, - "polyfill": false, "regenerator": true } ], @@ -20,7 +18,7 @@ "module-resolver", { "root": [ - "./src/" + "./src" ], "alias": { "material-ui": "@material-ui/core", diff --git a/.eslintrc b/.eslintrc index c25349f..60c5ffe 100644 --- a/.eslintrc +++ b/.eslintrc @@ -54,7 +54,9 @@ }, "settings": { "import/resolver": { - "babel-module": {} + "babel-module": { + "root": ["./src"] + } } } } diff --git a/.gitignore b/.gitignore index 5b381b0..9fc5eb4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ yarn.lock coverage/**/* -.babelrc +./.babelrc diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..38a9da4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,68 @@ +### [Versions](https://github.com/thundermiracle/next-mui-helper/releases/) + +## 1.1.0 +###### *Oct 24, 2018* + +#### Breaking Changes + +N/A + +#### Changes + +- Upgrade to babel7 +- Support next.js@v7.0.0 now + + +## 1.0.5 +###### *Sep 14, 2018* + +#### Breaking Changes + +N/A + +#### Changes + +- Fix minor bugs +- Add DefaultNextDocument to makeNextDocument.js +- Add DefaultNextApp to makeNextApp.js + + +## 1.0.4 +###### *Sep 14, 2018* + +#### Breaking Changes + +- Change name from nextjs-mui-helper to next-mui-helper + + +## 1.0.2 +###### *Sep 13, 2018* + +#### Breaking Changes + +N/A + +#### Changes + +- Support next.js _app.js + + +## 1.0.1 +###### *Aug 15, 2018* + +#### Breaking Changes + +N/A + +#### Changes + +- Add tests to improve quality of utils + + +## 1.0.0 +###### *May 21, 2018* + +#### Breaking Changes + +- Support @material-ui/core ONLY +- If you want to use material-ui@beta version, please use v0.2.8 instead diff --git a/examples/withTheme/src/client/layout/CommonLayout.js b/examples/withTheme/src/client/layout/CommonLayout.js index 0cf6f6b..a179533 100644 --- a/examples/withTheme/src/client/layout/CommonLayout.js +++ b/examples/withTheme/src/client/layout/CommonLayout.js @@ -24,7 +24,7 @@ function ButtonAppBar(props) {
- + Title diff --git a/examples/withTheme/src/client/style/theme.js b/examples/withTheme/src/client/style/theme.js index 19d3a91..40abb64 100644 --- a/examples/withTheme/src/client/style/theme.js +++ b/examples/withTheme/src/client/style/theme.js @@ -5,6 +5,9 @@ const theme = { primary: deepOrange, secondary: teal, }, + typography: { + useNextVariants: true, + }, }; export default theme; diff --git a/examples/withThemeApp/src/client/layout/CommonLayout.js b/examples/withThemeApp/src/client/layout/CommonLayout.js index 0cf6f6b..a179533 100644 --- a/examples/withThemeApp/src/client/layout/CommonLayout.js +++ b/examples/withThemeApp/src/client/layout/CommonLayout.js @@ -24,7 +24,7 @@ function ButtonAppBar(props) {
- + Title diff --git a/examples/withThemeApp/src/client/style/theme.js b/examples/withThemeApp/src/client/style/theme.js index 19d3a91..40abb64 100644 --- a/examples/withThemeApp/src/client/style/theme.js +++ b/examples/withThemeApp/src/client/style/theme.js @@ -5,6 +5,9 @@ const theme = { primary: deepOrange, secondary: teal, }, + typography: { + useNextVariants: true, + }, }; export default theme; diff --git a/jest.config.js b/jest.config.js index 3e8eef4..12900d7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,4 @@ module.exports = { collectCoverage: true, - transformIgnorePatterns: ['"/node_modules/(?!ramda).+\\.js$"'], + transformIgnorePatterns: ['"/node_modules/(?!ramda).+\\.js$"', 'dist'], }; diff --git a/jsconfig.json b/jsconfig.json index b5c5ad0..14fbe71 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,9 +1,10 @@ { "compilerOptions": { "experimentalDecorators": true, - "baseUrl": "./", + "baseUrl": ".", "paths": { - "src/*": ["./src/*"] + "*": ["src/*"], + "material-ui": ["@material-ui/core"] } }, "exclude": [ diff --git a/package.json b/package.json index 59902c7..1c426b5 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "next-mui-helper", - "version": "1.0.5", + "version": "1.1.0", "description": "hocs for making material-ui project with next.js(SSR)", "main": "./src/mui/withParts.js", "scripts": { "eslint": "eslint ./src", "build:rm": "rm -rf dist/", - "build:cp": "node ./scripts/copyFiles dist/ package.json README.md LICENSE", + "build:cp": "node ./scripts/copyFiles dist/ package.json README.md CHANGELOG.md LICENSE", "build": "npm run build:rm && cp .babelrc.prod .babelrc && NODE_ENV=production babel src --out-dir ./dist && npm run build:cp", "jest": "jest", "dev": "cp .babelrc.dev .babelrc && next", @@ -31,38 +31,39 @@ }, "peerDependencies": { "@material-ui/core": "^1.0 || ^3.0", - "next": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0", + "next": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", "react": "^15.0.0 || ^16.0.0", "react-dom": "^15.0.0 || ^16.0.0" }, "devDependencies": { - "@material-ui/core": "^3.0.3", - "babel-cli": "^6.26.0", - "babel-core": "^6.26.3", - "babel-eslint": "^9.0.0", + "@babel/cli": "^7.1.2", + "@babel/core": "^7.1.2", + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.1.0", + "@babel/preset-env": "^7.1.0", + "@babel/preset-react": "^7.0.0", + "@material-ui/core": "^3.3.1", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", "babel-plugin-add-module-exports": "^1.0.0", "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-react-require": "^3.0.0", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-plugin-transform-react-remove-prop-types": "^0.4.15", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "^1.7.0", - "babel-preset-react": "^6.24.1", - "eslint": "^5.5.0", + "babel-plugin-react-require": "^3.0.1", + "babel-plugin-transform-react-remove-prop-types": "^0.4.19", + "eslint": "^5.7.0", "eslint-config-airbnb": "^17.1.0", "eslint-config-react": "^1.1.7", - "eslint-import-resolver-babel-module": "^4.0.0", + "eslint-import-resolver-babel-module": "^5.0.0-beta.1", "eslint-plugin-import": "^2.14.0", - "eslint-plugin-jest": "^21.22.0", - "eslint-plugin-jsx-a11y": "^6.1.1", + "eslint-plugin-jest": "^21.26.0", + "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-react": "^7.11.1", "jest": "^23.6.0", - "next": "^6.1.2", + "next": "^7.0.2", "prop-types": "^15.6.2", - "react": "^16.5.0", - "react-dom": "^16.5.0", + "react": "^16.6.0", + "react-dom": "^16.6.0", "regenerator-runtime": "^0.12.1" }, "jest": { diff --git a/src/mui/defaultTheme.js b/src/mui/defaultTheme.js index a122ccd..3d961ab 100644 --- a/src/mui/defaultTheme.js +++ b/src/mui/defaultTheme.js @@ -2,15 +2,10 @@ import { blue, pink } from 'material-ui/colors'; export default { palette: { - primary: { - light: blue[300], - main: blue[500], - dark: blue[700], - }, - secondary: { - light: pink[300], - main: pink[500], - dark: pink[700], - }, + primary: blue, + secondary: pink, + }, + typography: { + useNextVariants: true, }, }; diff --git a/src/nextjs/extendsWithMui.js b/src/nextjs/extendsWithMui.js index f57e917..2d84b01 100644 --- a/src/nextjs/extendsWithMui.js +++ b/src/nextjs/extendsWithMui.js @@ -62,6 +62,7 @@ const extendsWithMui = theme => ((DocumentComponent) => { const jssStyles = (