-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add new API for react-router 6 #274
Changes from all commits
e821364
8e64efd
71bdf3e
3ef0c8a
58a72b9
6e54e63
4b8a1d1
c317f49
c720629
8914d49
a308d9d
6960502
0633a46
37ace82
572cd1f
32e0102
f39e794
b50a031
7e886a1
952a2b7
b80dd17
ae234ca
86ddb97
978ba66
ccfd34b
4093629
7ec4bcc
f6da2cb
c486651
4034d2c
2b5d981
e6bb144
3d27da2
fa8779b
cadc88d
d811d3a
7dc3b97
15c7c5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,20 @@ | |
"dev": "yarn bundle --watch", | ||
"generate": "yarn --cwd generator install && yarn --cwd generator generate" | ||
}, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"types": "./dist/bundles/types/index.d.ts", | ||
"import": "./dist/bundles/okta-react.esm.js", | ||
"require": "./dist/bundles/okta-react.cjs.js", | ||
"default": "./dist/bundles/okta-react.umd.js" | ||
}, | ||
"./react-router-5": { | ||
"types": "./dist/bundles/types/react-router-5.d.ts", | ||
"import": "./dist/bundles/okta-react-router-5.esm.js", | ||
"require": "./dist/bundles/okta-react-router-5.cjs.js" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/okta/okta-react.git" | ||
|
@@ -52,10 +66,13 @@ | |
"peerDependencies": { | ||
"@okta/okta-auth-js": "^5.3.1 || ^6.0.0 || ^7.0.0", | ||
"react": ">=16.8.0", | ||
"react-dom": ">=16.8.0", | ||
"react-dom": ">=16.8.0" | ||
}, | ||
"optionalDependencies": { | ||
"react-router-dom": ">=5.1.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a minimum version of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to decouple There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood, but a optional dependencies and a peer dependencies and a optional peer dependencies are not the same thing. Optional dependency: A dependency that is may or may not be included (optional) to use a package. In the SIW we used to use a async library called Peer dependency: A dependency which the application and library need a common version/instance of. For example Optional Peer Dependency: Same as a peer dependency, however including the peer dependency is optional Optional Peer Dependencies are defined as so:
|
||
}, | ||
"devDependencies": { | ||
"react-router-dom5": "npm:react-router-dom@^5.2.0", | ||
"@babel/cli": "^7.19.3", | ||
"@babel/core": "^7.19.3", | ||
"@babel/plugin-transform-runtime": "^7.19.1", | ||
|
@@ -71,7 +88,6 @@ | |
"@types/jest": "^29.5.4", | ||
"@types/react": "^16.9.0", | ||
"@types/react-dom": "^16.9.0", | ||
"@types/react-router-dom": "^5.1.6", | ||
"@typescript-eslint/eslint-plugin": "^4.8.1", | ||
"@typescript-eslint/parser": "^4.8.1", | ||
"axios": "^0.27.2", | ||
|
@@ -87,7 +103,7 @@ | |
"eslint-plugin-jsx-a11y": "^6.0.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-react": "^7.3.0", | ||
"eslint-plugin-react-hooks": "^2.5.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"globby": "^11.0.1", | ||
"jasmine-core": "~2.6.2", | ||
"jasmine-spec-reporter": "~4.1.0", | ||
|
@@ -98,7 +114,6 @@ | |
"prop-types": "^15.5.10", | ||
"react": "^16.9.0", | ||
"react-dom": "^16.9.0", | ||
"react-router-dom": "5.2.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^2.33.1", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
|
@@ -119,7 +134,8 @@ | |
"samples/**/*", | ||
"samples/routing/**/*", | ||
"test/apps/*", | ||
"test/e2e" | ||
"test/e2e", | ||
"test/jest" | ||
], | ||
"nohoist": [ | ||
"**/@wdio/**", | ||
|
@@ -132,7 +148,9 @@ | |
"**/@types/react/**", | ||
"**/@types/react-dom", | ||
"**/@types/react-dom/**", | ||
"**/@types/react-router-dom" | ||
"**/@types/react-router-dom", | ||
"**/@reach/router/", | ||
"**/@reach/router/**" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ const makeExternalPredicate = () => { | |
const externalArr = [ | ||
...Object.keys(pkg.peerDependencies || {}), | ||
...Object.keys(pkg.dependencies || {}), | ||
// for SecureRoute: | ||
...Object.keys(pkg.optionalDependencies || {}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is needed (see |
||
'@okta/okta-react', | ||
]; | ||
|
||
if (externalArr.length === 0) { | ||
|
@@ -72,7 +75,8 @@ export default [ | |
globals: { | ||
'react': 'React', | ||
'react-router-dom': 'ReactRouterDOM', | ||
'@okta/okta-auth-js': 'OktaAuth' | ||
'@okta/okta-auth-js': 'OktaAuth', | ||
'compare-versions': 'compareVersions', | ||
} | ||
} | ||
}, | ||
|
@@ -107,5 +111,37 @@ export default [ | |
sourcemap: true | ||
} | ||
] | ||
}, | ||
{ | ||
input: 'src/react-router-5.ts', | ||
external, | ||
plugins: [ | ||
...commonPlugins, | ||
babel({ | ||
babelHelpers: 'runtime', | ||
presets: [ | ||
'@babel/preset-env', | ||
'@babel/preset-react' | ||
], | ||
plugins: [ | ||
'@babel/plugin-transform-runtime' | ||
], | ||
extensions | ||
}), | ||
], | ||
output: [ | ||
{ | ||
format: 'cjs', | ||
file: 'dist/bundles/okta-react-router-5.cjs.js', | ||
exports: 'named', | ||
sourcemap: true | ||
}, | ||
{ | ||
format: 'esm', | ||
file: 'dist/bundles/okta-react-router-5.esm.js', | ||
exports: 'named', | ||
sourcemap: true | ||
} | ||
] | ||
} | ||
]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we export a
react-router-6
bundle as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could export a
react-router-6
bundle with one component called likeSecureOutlet
that just renders<AuthRequired><Outlet /></AuthRequired>
Probably we should not name it
SecureRoute
as in RR5, because it's not a route.