diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fc379a7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +## [2.3.0] + +- Refactoring +- Fixed a few typescript issues +- Updated styleguide and build system +- Dropped old examples + +## [2.0.0] + +- React 18 support +- The new approach to handle asynchronous actions +- A few fixes diff --git a/examples/1-simple-without-backend/package.json b/examples/1-simple-without-backend/package.json index 3c11dd3..05caee9 100644 --- a/examples/1-simple-without-backend/package.json +++ b/examples/1-simple-without-backend/package.json @@ -13,6 +13,6 @@ }, "devDependencies": { "@types/lodash": "^4.14.149", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/10-redux-sagas/package.json b/examples/10-redux-sagas/package.json index edd0685..45aad19 100644 --- a/examples/10-redux-sagas/package.json +++ b/examples/10-redux-sagas/package.json @@ -15,14 +15,14 @@ "koa-static": "5.0.0", "react": "17.0.2", "react-dom": "17.0.2", - "react-redux": "7.1.1", - "redux": "4.0.4", + "react-redux": "8.1.3", + "redux": "4.2.1", "redux-logger": "3.0.6", - "redux-saga": "1.1.1", + "redux-saga": "1.3.0", "serialize-javascript": "3.0.0" }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/11-redux-thunk/package.json b/examples/11-redux-thunk/package.json index 989791c..21fb297 100644 --- a/examples/11-redux-thunk/package.json +++ b/examples/11-redux-thunk/package.json @@ -15,14 +15,14 @@ "koa-static": "5.0.0", "react": "17.0.2", "react-dom": "17.0.2", - "react-redux": "7.1.1", - "redux": "4.0.4", + "react-redux": "8.1.3", + "redux": "4.2.1", "redux-logger": "3.0.6", "redux-thunk": "2.3.0", "serialize-javascript": "3.0.0" }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/12-apollo-graphql/package.json b/examples/12-apollo-graphql/package.json index 4cbce4e..2fc0f27 100644 --- a/examples/12-apollo-graphql/package.json +++ b/examples/12-apollo-graphql/package.json @@ -6,7 +6,7 @@ "build": "cross-env NODE_ENV=production node build" }, "dependencies": { - "@apollo/react-hooks": "3.1.5", + "@apollo/client": "^3.11.8", "@issr/core": "2.0.0", "apollo-cache-inmemory": "1.6.5", "apollo-client": "2.6.8", @@ -17,12 +17,11 @@ "koa-static": "5.0.0", "node-fetch": "2.6.0", "react": "17.0.2", - "react-apollo": "3.1.5", "react-dom": "17.0.2", "serialize-javascript": "3.0.0" }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/13-dom-manipulations/package.json b/examples/13-dom-manipulations/package.json index f46bc20..fb11ec0 100644 --- a/examples/13-dom-manipulations/package.json +++ b/examples/13-dom-manipulations/package.json @@ -17,6 +17,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/14-nested-data-redux-graphql/package.json b/examples/14-nested-data-redux-graphql/package.json index ea90538..ab77ba4 100644 --- a/examples/14-nested-data-redux-graphql/package.json +++ b/examples/14-nested-data-redux-graphql/package.json @@ -6,7 +6,7 @@ "build": "cross-env NODE_ENV=production node build" }, "dependencies": { - "@apollo/react-hooks": "3.1.5", + "@apollo/client": "^3.11.8", "@issr/core": "2.0.0", "@reduxjs/toolkit": "1.1.0", "apollo-cache-inmemory": "1.6.5", @@ -19,16 +19,15 @@ "koa-static": "5.0.0", "node-fetch": "2.6.0", "react": "17.0.2", - "react-apollo": "3.1.5", "react-dom": "17.0.2", - "react-redux": "7.1.1", - "redux": "4.0.4", + "react-redux": "8.1.3", + "redux": "4.2.1", "redux-logger": "3.0.6", "redux-saga": "1.1.1", "serialize-javascript": "3.0.0" }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/15-nested-async-effect/package.json b/examples/15-nested-async-effect/package.json index 20a8db2..af17369 100644 --- a/examples/15-nested-async-effect/package.json +++ b/examples/15-nested-async-effect/package.json @@ -16,6 +16,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/16-mobx/package.json b/examples/16-mobx/package.json index 7179ba2..c915acd 100644 --- a/examples/16-mobx/package.json +++ b/examples/16-mobx/package.json @@ -18,6 +18,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/19-react-18/package.json b/examples/19-react-18/package.json index 884e6ab..5135d4b 100644 --- a/examples/19-react-18/package.json +++ b/examples/19-react-18/package.json @@ -17,6 +17,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/2-simple-express/package.json b/examples/2-simple-express/package.json index 94ffebb..75f500a 100644 --- a/examples/2-simple-express/package.json +++ b/examples/2-simple-express/package.json @@ -14,6 +14,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/2.1-simple-express-only-client/package.json b/examples/2.1-simple-express-only-client/package.json index be35ca4..628d489 100644 --- a/examples/2.1-simple-express-only-client/package.json +++ b/examples/2.1-simple-express-only-client/package.json @@ -15,6 +15,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/3-simple-koa/package.json b/examples/3-simple-koa/package.json index 659afb9..65b4d4d 100644 --- a/examples/3-simple-koa/package.json +++ b/examples/3-simple-koa/package.json @@ -16,6 +16,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/4-koa-react-router/package.json b/examples/4-koa-react-router/package.json index c3f0044..e66c20c 100644 --- a/examples/4-koa-react-router/package.json +++ b/examples/4-koa-react-router/package.json @@ -19,6 +19,6 @@ }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/5-meta-tags/build.js b/examples/5-meta-tags-helmet/build.js similarity index 100% rename from examples/5-meta-tags/build.js rename to examples/5-meta-tags-helmet/build.js diff --git a/examples/5-meta-tags/package.json b/examples/5-meta-tags-helmet/package.json similarity index 83% rename from examples/5-meta-tags/package.json rename to examples/5-meta-tags-helmet/package.json index ed4ce14..51edec3 100644 --- a/examples/5-meta-tags/package.json +++ b/examples/5-meta-tags-helmet/package.json @@ -1,5 +1,5 @@ { - "name": "@issr/example-5", + "name": "@issr/example-5.1", "version": "1.0.0", "scripts": { "start": "cross-env NODE_ENV=development node build", @@ -13,13 +13,13 @@ "koa-static": "5.0.0", "react": "17.0.2", "react-dom": "17.0.2", - "react-meta-tags": "0.7.4", + "react-helmet-async": "2.0.5", "react-router": "5.1.2", "react-router-dom": "5.1.2", "serialize-javascript": "3.0.0" }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/5-meta-tags/rockpack.babel.js b/examples/5-meta-tags-helmet/rockpack.babel.js similarity index 100% rename from examples/5-meta-tags/rockpack.babel.js rename to examples/5-meta-tags-helmet/rockpack.babel.js diff --git a/examples/5.1-meta-tags-helmet/src/App.jsx b/examples/5-meta-tags-helmet/src/App.jsx similarity index 100% rename from examples/5.1-meta-tags-helmet/src/App.jsx rename to examples/5-meta-tags-helmet/src/App.jsx diff --git a/examples/5-meta-tags/src/assets/favicon.ico b/examples/5-meta-tags-helmet/src/assets/favicon.ico similarity index 100% rename from examples/5-meta-tags/src/assets/favicon.ico rename to examples/5-meta-tags-helmet/src/assets/favicon.ico diff --git a/examples/5.1-meta-tags-helmet/src/client.jsx b/examples/5-meta-tags-helmet/src/client.jsx similarity index 100% rename from examples/5.1-meta-tags-helmet/src/client.jsx rename to examples/5-meta-tags-helmet/src/client.jsx diff --git a/examples/5.1-meta-tags-helmet/src/server.jsx b/examples/5-meta-tags-helmet/src/server.jsx similarity index 100% rename from examples/5.1-meta-tags-helmet/src/server.jsx rename to examples/5-meta-tags-helmet/src/server.jsx diff --git a/examples/5-meta-tags/src/App.jsx b/examples/5-meta-tags/src/App.jsx deleted file mode 100644 index 880191b..0000000 --- a/examples/5-meta-tags/src/App.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import { Switch, Route, Link } from 'react-router-dom'; -import MetaTags from 'react-meta-tags'; -import { useSsrState, useSsrEffect, useRegisterEffect } from '@issr/core'; - -const asyncFn = () => new Promise((resolve) => setTimeout(() => resolve('Hello world'), 1000)); - -const Home = () => { - const [state, setState] = useSsrState('i am test'); - const registerEffect = useRegisterEffect(); - - useSsrEffect(() => { - registerEffect(asyncFn).then(data => { - setState(data); - }); - }, []); - - return ( - <> - - Home - - -
-

{state}

- secondary -
- - ); -}; - -const Secondary = () => ( - <> - - Secondary - - -
-

Secondary

- Home -
- -); - -export const App = () => ( - - - - -); diff --git a/examples/5-meta-tags/src/client.jsx b/examples/5-meta-tags/src/client.jsx deleted file mode 100644 index 490ffd9..0000000 --- a/examples/5-meta-tags/src/client.jsx +++ /dev/null @@ -1,16 +0,0 @@ -import { hydrate } from 'react-dom'; -import { Router } from 'react-router-dom'; -import { createBrowserHistory } from 'history'; -import { App } from './App'; -import { createSsr } from '@issr/core'; - -const SSR = createSsr(window.SSR_DATA); - -hydrate( - - - - - , - document.getElementById('root') -); diff --git a/examples/5-meta-tags/src/server.jsx b/examples/5-meta-tags/src/server.jsx deleted file mode 100644 index 1b4d290..0000000 --- a/examples/5-meta-tags/src/server.jsx +++ /dev/null @@ -1,58 +0,0 @@ -import path from 'path'; -import Koa from 'koa'; -import serve from 'koa-static'; -import Router from 'koa-router'; -import { StaticRouter } from 'react-router'; -import serialize from 'serialize-javascript'; -import MetaTagsServer from 'react-meta-tags/server'; -import { MetaTagsContext } from 'react-meta-tags'; - -import { App } from './App'; -import { serverRender } from '@issr/core'; - -const app = new Koa(); -const router = new Router(); - -app.use(serve(path.resolve(__dirname, '../public'))); - -router.get('/*', async (ctx) => { - const { url } = ctx.request; - const routerParams = { - location: url, - context: {} - }; - const metaTagsInstance = MetaTagsServer(); - - const { html, state } = await serverRender.string(() => ( - - - - - - )); - const meta = metaTagsInstance.renderToString(); - - ctx.body = ` - - - - ${meta} - - - -
${html}
- - - -`; -}); - -app - .use(router.routes()) - .use(router.allowedMethods()); - -const server = app.listen(4000, () => { - console.log(`Server is listening ${4000} port`); -}); diff --git a/examples/5.1-meta-tags-helmet/build.js b/examples/5.1-meta-tags-helmet/build.js deleted file mode 100644 index 9edf3b5..0000000 --- a/examples/5.1-meta-tags-helmet/build.js +++ /dev/null @@ -1,16 +0,0 @@ -const path = require('path'); -const { isomorphicCompiler, backendCompiler, frontendCompiler } = require('@rockpack/compiler'); - -isomorphicCompiler( - backendCompiler({ - src: 'src/server.jsx', - dist: 'dist', - }), - frontendCompiler({ - src: 'src/client.jsx', - dist: 'public', - copy: [ - { from: path.resolve(__dirname, './src/assets/favicon.ico'), to: './' } - ] - }) -); diff --git a/examples/5.1-meta-tags-helmet/package.json b/examples/5.1-meta-tags-helmet/package.json deleted file mode 100644 index c0abef9..0000000 --- a/examples/5.1-meta-tags-helmet/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@issr/example-5.1", - "version": "1.0.0", - "scripts": { - "start": "cross-env NODE_ENV=development node build", - "build": "cross-env NODE_ENV=production node build" - }, - "dependencies": { - "@issr/core": "2.0.0", - "history": "4.10.1", - "koa": "2.11.0", - "koa-router": "8.0.8", - "koa-static": "5.0.0", - "react": "16.13.1", - "react-dom": "16.13.1", - "react-helmet-async": "1.0.7", - "react-router": "5.1.2", - "react-router-dom": "5.1.2", - "serialize-javascript": "3.0.0" - }, - "devDependencies": { - "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" - } -} diff --git a/examples/5.1-meta-tags-helmet/rockpack.babel.js b/examples/5.1-meta-tags-helmet/rockpack.babel.js deleted file mode 100644 index 006fdfc..0000000 --- a/examples/5.1-meta-tags-helmet/rockpack.babel.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: [ - '@issr/babel-plugin' - ] -} diff --git a/examples/5.1-meta-tags-helmet/src/assets/favicon.ico b/examples/5.1-meta-tags-helmet/src/assets/favicon.ico deleted file mode 100644 index c4ae0f5..0000000 Binary files a/examples/5.1-meta-tags-helmet/src/assets/favicon.ico and /dev/null differ diff --git a/examples/6-css-modules-other-styles/package.json b/examples/6-css-modules-other-styles/package.json index 6638be6..673e811 100644 --- a/examples/6-css-modules-other-styles/package.json +++ b/examples/6-css-modules-other-styles/package.json @@ -13,13 +13,12 @@ "koa-static": "5.0.0", "react": "17.0.2", "react-dom": "17.0.2", - "react-meta-tags": "0.7.4", "react-router": "5.1.2", "react-router-dom": "5.1.2", "serialize-javascript": "3.0.0" }, "devDependencies": { "@issr/babel-plugin": "2.0.0", - "@rockpack/compiler": "3.0.0-next.2" + "@rockpack/compiler": "4.5.2" } } diff --git a/examples/6-css-modules-other-styles/src/App.jsx b/examples/6-css-modules-other-styles/src/App.jsx index 197438b..5e69782 100644 --- a/examples/6-css-modules-other-styles/src/App.jsx +++ b/examples/6-css-modules-other-styles/src/App.jsx @@ -1,5 +1,4 @@ import { Switch, Route, Link } from 'react-router-dom'; -import MetaTags from 'react-meta-tags'; import { useSsrState, useSsrEffect, useRegisterEffect } from '@issr/core'; import styles from './styles.module.scss'; import './styles.css'; @@ -18,10 +17,6 @@ const Home = () => { return ( <> - - Home - -

{state}

secondary diff --git a/examples/6-css-modules-other-styles/src/server.jsx b/examples/6-css-modules-other-styles/src/server.jsx index c18fc02..4eeb967 100644 --- a/examples/6-css-modules-other-styles/src/server.jsx +++ b/examples/6-css-modules-other-styles/src/server.jsx @@ -4,8 +4,6 @@ import serve from 'koa-static'; import Router from 'koa-router'; import { StaticRouter } from 'react-router'; import serialize from 'serialize-javascript'; -import MetaTagsServer from 'react-meta-tags/server'; -import { MetaTagsContext } from 'react-meta-tags'; import { App } from './App'; import { serverRender } from '@issr/core'; @@ -21,22 +19,17 @@ router.get('/*', async (ctx) => { location: url, context: {} }; - const metaTagsInstance = MetaTagsServer(); const { html, state } = await serverRender.string(() => ( - - - - - + + + )); - const meta = metaTagsInstance.renderToString(); ctx.body = ` - ${meta}