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

Upgrade packages and refactor a bit #500

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"lint:staged": "lint-staged --debug"
},
"devDependencies": {
"eslint": "8.6.0",
"eslint-config-ringcentral-typescript": "7.0.1",
"husky": "7.0.4",
"lerna": "4.0.0",
"lint-staged": "11.1.2",
"prettier": "2.5.1",
"eslint": "8.26.0",
"eslint-config-ringcentral-typescript": "7.0.3",
"husky": "8.0.1",
"lerna": "6.0.1",
"lint-staged": "13.0.3",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"typescript": "4.5.2"
"typescript": "4.8.4"
},
"workspaces": [
"packages/*"
Expand Down
1 change: 0 additions & 1 deletion packages/demo-page/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
22 changes: 11 additions & 11 deletions packages/demo-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
"dependencies": {
"jsondiffpatch": "0.4.1",
"next-redux-wrapper": "*",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"redux": "4.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.0.4",
"redux": "4.2.0",
"redux-logger": "3.0.6"
},
"devDependencies": {
"@playwright/test": "1.17.1",
"@types/react": "17.0.37",
"@types/react-dom": "17.0.11",
"@types/react-redux": "7.1.20",
"@playwright/test": "1.27.1",
"@types/react": "18.0.24",
"@types/react-dom": "18.0.8",
"@types/react-redux": "7.1.24",
"@types/redux-logger": "3.0.9",
"next": "12.0.4",
"next": "13.0.1",
"next-redux-wrapper-configs": "*",
"playwright": "1.17.1",
"playwright": "1.27.1",
"rimraf": "3.0.2",
"typescript": "4.5.2"
"typescript": "4.8.4"
},
"author": "Kirill Konshin",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/demo-page/src/components/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import reducer, {State} from './reducer';
export const makeStore = (context: Context) => {
const store = createStore(reducer, applyMiddleware(logger));

if (module.hot) {
module.hot.accept('./reducer', () => {
if ((module as any).hot) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familliar with module.hot; it's showing type errors because that property doesn't exist in there. Is this still used?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the way to hot-swap reducer on client side. This is Webpack's thing.

(module as any).hot.accept('./reducer', () => {
console.log('Replacing reducer');
store.replaceReducer(require('./reducer').default);
});
Expand Down
4 changes: 1 addition & 3 deletions packages/demo-page/src/pages/_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const ErrorPage = ({page}: any) => (
<>
<p>This is an error page, {page}.</p>
<nav>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/">Navigate to index</Link>
</nav>
</>
);
Expand Down
8 changes: 2 additions & 6 deletions packages/demo-page/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ const Page: NextPage<ConnectedPageProps> = ({custom}) => {
return (
<div className="index">
<pre>{JSON.stringify({page, custom}, null, 2)}</pre>
<Link href="/other">
<a>Navigate</a>
</Link>
<Link href="/other">Navigate</Link>
{' | '}
<Link href="/error">
<a>Navigate to error</a>
</Link>
<Link href="/error">Navigate to error</Link>
</div>
);
};
Expand Down
8 changes: 2 additions & 6 deletions packages/demo-page/src/pages/other.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ const OtherPage: NextPage<State> = () => {
<pre>{JSON.stringify({page}, null, 2)}</pre>
<nav>
<button onClick={bump}>bump</button>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/other2">
<a>Navigate to other 2</a>
</Link>
<Link href="/">Navigate to index</Link>
<Link href="/other2">Navigate to other 2</Link>
</nav>
</div>
);
Expand Down
8 changes: 2 additions & 6 deletions packages/demo-page/src/pages/other2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ const OtherPage: NextPage<State> = () => {
<pre>{JSON.stringify({page}, null, 2)}</pre>
<nav>
<button onClick={bump}>bump</button>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/other">
<a>Navigate to other</a>
</Link>
<Link href="/">Navigate to index</Link>
<Link href="/other">Navigate to other</Link>
</nav>
</div>
);
Expand Down
4 changes: 1 addition & 3 deletions packages/demo-page/src/pages/pageProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const PropsPage: NextPage<State> = props => {
<p>Using Next.js default prop in a wrapped component.</p>
<pre>{JSON.stringify(props)}</pre>
<nav>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/">Navigate to index</Link>
</nav>
</div>
);
Expand Down
1 change: 0 additions & 1 deletion packages/demo-redux-toolkit/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
16 changes: 8 additions & 8 deletions packages/demo-redux-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"start": "next --port=6060"
},
"dependencies": {
"@reduxjs/toolkit": "1.6.2",
"@reduxjs/toolkit": "1.8.6",
"next-redux-wrapper": "*",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"redux": "4.1.2"
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.0.4",
"redux": "4.2.0"
},
"devDependencies": {
"@playwright/test": "1.17.1",
"next": "12.0.4",
"playwright": "1.17.1"
"@playwright/test": "1.27.1",
"next": "13.0.1",
"playwright": "1.27.1"
},
"license": "MIT"
}
4 changes: 1 addition & 3 deletions packages/demo-redux-toolkit/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export default function IndexPage() {
You can see &quot;Rendered content: undefined&quot; in browser console after navigating between these pages:
<br />
<br />
<Link href="/subject/1">
<a>Go to problem pages</a>
</Link>
<Link href="/subject/1">Go to problem pages</Link>
</div>
);
}
8 changes: 2 additions & 6 deletions packages/demo-redux-toolkit/pages/subject/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ const Page = props => {
return (
<div className={`page${content.id}`}>
<h3>{content.name}</h3>
<Link href="/subject/1">
<a>Go id=1</a>
</Link>
<Link href="/subject/1">Go id=1</Link>
&nbsp;&nbsp;&nbsp;&nbsp;
<Link href="/subject/2">
<a>Go id=2</a>
</Link>
<Link href="/subject/2">Go id=2</Link>
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion packages/demo-saga-page/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
24 changes: 12 additions & 12 deletions packages/demo-saga-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"dependencies": {
"jsondiffpatch": "0.4.1",
"next-redux-wrapper": "*",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"redux": "4.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.0.4",
"redux": "4.2.0",
"redux-logger": "3.0.6",
"redux-saga": "1.1.3"
"redux-saga": "1.2.1"
},
"devDependencies": {
"@playwright/test": "1.17.1",
"@types/react": "17.0.37",
"@types/react-dom": "17.0.11",
"@types/react-redux": "7.1.20",
"@playwright/test": "1.27.1",
"@types/react": "18.0.24",
"@types/react-dom": "18.0.8",
"@types/react-redux": "7.1.24",
"@types/redux-logger": "3.0.9",
"next": "12.0.4",
"next": "13.0.1",
"next-redux-wrapper-configs": "*",
"playwright": "1.17.1",
"playwright": "1.27.1",
"rimraf": "3.0.2",
"typescript": "4.5.2"
"typescript": "4.8.4"
},
"author": "Kirill Konshin",
"repository": {
Expand Down
1 change: 0 additions & 1 deletion packages/demo-saga/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
24 changes: 12 additions & 12 deletions packages/demo-saga/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"dependencies": {
"jsondiffpatch": "0.4.1",
"next-redux-wrapper": "*",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"redux": "4.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.0.4",
"redux": "4.2.0",
"redux-logger": "3.0.6",
"redux-saga": "1.1.3"
"redux-saga": "1.2.1"
},
"devDependencies": {
"@playwright/test": "1.17.1",
"@types/react": "17.0.37",
"@types/react-dom": "17.0.11",
"@types/react-redux": "7.1.20",
"@playwright/test": "1.27.1",
"@types/react": "18.0.24",
"@types/react-dom": "18.0.8",
"@types/react-redux": "7.1.24",
"@types/redux-logger": "3.0.9",
"next": "12.0.4",
"next": "13.0.1",
"next-redux-wrapper-configs": "*",
"playwright": "1.17.1",
"playwright": "1.27.1",
"rimraf": "3.0.2",
"typescript": "4.5.2"
"typescript": "4.8.4"
},
"author": "Kirill Konshin",
"repository": {
Expand Down
1 change: 0 additions & 1 deletion packages/demo/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
22 changes: 11 additions & 11 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
},
"dependencies": {
"next-redux-wrapper": "*",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
"redux": "4.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.0.4",
"redux": "4.2.0",
"redux-logger": "3.0.6"
},
"devDependencies": {
"@playwright/test": "1.17.1",
"@types/react": "17.0.37",
"@types/react-dom": "17.0.11",
"@types/react-redux": "7.1.20",
"@playwright/test": "1.27.1",
"@types/react": "18.0.24",
"@types/react-dom": "18.0.8",
"@types/react-redux": "7.1.24",
"@types/redux-logger": "3.0.9",
"next": "12.0.4",
"next": "13.0.1",
"next-redux-wrapper-configs": "*",
"playwright": "1.17.1",
"playwright": "1.27.1",
"rimraf": "3.0.2",
"typescript": "4.5.2"
"typescript": "4.8.4"
},
"author": "Kirill Konshin",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/src/components/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import reducer, {State} from './reducer';
export const makeStore = (context: Context) => {
const store = createStore(reducer, applyMiddleware(logger));

if (module.hot) {
module.hot.accept('./reducer', () => {
if ((module as any).hot) {
(module as any).hot.accept('./reducer', () => {
console.log('Replacing reducer');
store.replaceReducer(require('./reducer').default);
});
Expand Down
4 changes: 1 addition & 3 deletions packages/demo/src/pages/_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const Error: NextPage = () => {
This is an error page, it also has access to store: <code>{app}</code>
</p>
<nav>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/">Navigate to index</Link>
</nav>
</>
);
Expand Down
12 changes: 3 additions & 9 deletions packages/demo/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,11 @@ class Index extends React.Component<PageProps> {

<pre>{JSON.stringify({pageProp, appProp, app, page}, null, 2)}</pre>

<Link href="/server">
<a>Navigate</a>
</Link>
<Link href="/server">Navigate</Link>
{' | '}
<Link href="/static">
<a>Navigate to static</a>
</Link>
<Link href="/static">Navigate to static</Link>
{' | '}
<Link href="/error">
<a>Navigate to error</a>
</Link>
<Link href="/error">Navigate to error</Link>
</div>
);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/demo/src/pages/pageProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const PropsPage: NextPage<State> = props => {
<p>Using Next.js default prop in a wrapped component.</p>
<pre>{JSON.stringify(props)}</pre>
<nav>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/">Navigate to index</Link>
</nav>
</div>
);
Expand Down
4 changes: 1 addition & 3 deletions packages/demo/src/pages/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ const Server: NextPage<OtherProps> = ({appProp, getServerSideProp}) => {
<pre>{JSON.stringify({app, page, getServerSideProp, appProp}, null, 2)}</pre>

<nav>
<Link href="/">
<a>Navigate to index</a>
</Link>
<Link href="/">Navigate to index</Link>
</nav>
</div>
);
Expand Down
Loading