admin/package.json
xidedix 349393e60b refactor: update to react router v5
###### dependencies update
- update: `@coreui/react` to `~2.5.0`
- update: `react-router-config` to `^5.0.0`
- update: `react-router-dom` to `^5.0.0`

__BREAKING CHANGES__
- drop 'Breadcrumb' in favour of `Breadcrumb2`
- drop 'SidebarNav' in favour of `SidebarNav2`
- __Breadcrumb2__: **mandatory** prop `router` see > [Breadcrumb](./src/Breadcrumb.md)
- __SidebarNav2__: **mandatory** prop `router`  see > [SidebarNav](./src/SidebarNav.md)

React Router v5 uses the new React Context API, which is incompatible with version used in 4.3.
That's a breaking change. With raw upgrade to v5, you can encounter an error message: `You should not render a <Route> outside a <Router>` or `You should not use <Link> outside a <Router>` etc... It means that Route, Link etc, can't find the correct context object because `Breadcrumb` and `SidebarNav` components have their own context object.

It's important to use the same instance of the `react-router-dom v5` library with template and coreui components. `@coreui/react` version `2.5.0` moves react-router-dom form dependencies to peerDependecies and takes the same library/module from the template/app instead. We have to pass router module object as a prop to `<AppSidebarNav>` and `<AppBreadcrumb>`

#####_migration guide v2.1 -> v2.5_ 💥
1. update `dependencies` in `package.json`
   - [ ] `@coreui/react` to `~2.5.0`
   - [ ] `react-router-dom` to `^5.0.0`
   - [ ] `react-router-config` to `^5.0.0`

2. modify `DefaultLayout.js`
   - [ ] import react-router-dom module as an object
     ```
     import * as router from 'react-router-dom';
     ```
   - [ ] import new versions of components `AppBreadcrumb2` and `AppSidebarNav2` (alias is optional, just keep consistency with markup)
     ```jsx
     import {
       ...
       AppBreadcrumb2 as AppBreadcrumb,
       AppSidebarNav2 as AppSidebarNav
       ...
     } from '@coreui/react';
     ```
   - [ ] inject `router` object as a prop to `<AppSidebarNav>` and `<AppBreadcrumb>`
     ```html
     <AppSidebarNav navConfig={navigation} {...this.props} router={router}/>
     ```

     ```html
     <AppBreadcrumb appRoutes={routes} router={router}/>
     ```

---
2019-05-16 17:51:38 +02:00

71 lines
1.9 KiB
JSON

{
"name": "@coreui/coreui-free-react-admin-template",
"version": "2.1.7",
"description": "CoreUI React Open Source Bootstrap 4 Admin Template",
"author": "Łukasz Holeczek",
"homepage": "https://coreui.io",
"copyright": "Copyright 2018 creativeLabs Łukasz Holeczek",
"license": "MIT",
"private": true,
"repository": {
"type": "git",
"url": "git@github.com:coreui/coreui-free-react-admin-template.git"
},
"dependencies": {
"@coreui/coreui": "^2.1.9",
"@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.3.0",
"@coreui/icons": "0.3.0",
"@coreui/react": "~2.5.0",
"bootstrap": "^4.3.1",
"chart.js": "^2.8.0",
"classnames": "^2.2.6",
"core-js": "^2.6.5",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.13.0",
"flag-icon-css": "^3.3.0",
"font-awesome": "^4.7.0",
"node-sass": "^4.12.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-app-polyfill": "^1.0.1",
"react-chartjs-2": "^2.7.6",
"react-dom": "^16.8.6",
"react-router-config": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-test-renderer": "^16.8.6",
"reactstrap": "^7.1.0",
"simple-line-icons": "^2.4.1"
},
"devDependencies": {
"react-scripts": "^3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:cov": "npm test -- --coverage --watchAll=false",
"test:debug": "react-scripts --inspect-brk test --runInBand",
"eject": "react-scripts eject"
},
"bugs": {
"url": "https://github.com/coreui/coreui-free-react-admin-template/issues"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 9",
"not op_mini all"
],
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
"!**/*index.js",
"!src/serviceWorker.js",
"!src/polyfill.js"
]
}
}