-
Notifications
You must be signed in to change notification settings - Fork 3
STRIPES-861 integration of module federation logic in the main branch. #173
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
base: main
Are you sure you want to change the base?
Changes from all commits
bc644ce
b9431f1
467f390
7c3576a
2deed9e
49189bd
12cc324
60b5dae
97ba155
8c47f56
84c0199
54db9c9
ecaa7a6
42cac16
12613ed
0c73e79
626a7c8
b399047
08068ed
8889e08
a8b5fb0
fddfec2
52d545f
2c8dbae
dbd8bde
c915218
0b23f66
233244e
c7739b0
89c80cb
a3b01e5
9639baa
2018a55
0ef9438
17ff134
eea2bb9
7cf2de0
c9182a9
6d4e80a
55c989a
cef8363
84dd206
7d47eb9
dbbeef8
093724d
08f7281
b9c3344
4e83e7b
4e58dc6
bded4e7
f2099e8
7fc5d00
a799aa6
43b1d09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // Anythign that we want *the platform to provide to modules should be here. | ||
| // If an item is not in this list, modules will each load their own version of it. | ||
| // This can be problematic for React Context if mutliple copies of the same context are loaded. | ||
|
|
||
| const singletons = { | ||
| '@folio/stripes-components': '^13.1.0', | ||
| '@folio/stripes-connect': '^10.0.1', | ||
| '@folio/stripes-core': '^11.1.0', | ||
| "moment": "^2.29.0", | ||
|
Comment on lines
+1
to
+9
Member
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. Typo: Anything 'moment' not "moment" These are all just fallback/default versions, right? Can we say that in the comments, or just initialize everything to null/empty string and then die later on if any value is still falsey? These hard-coded versions just make me cringe. |
||
| 'react': '~18.3', | ||
| 'react-dom': '~18.3', | ||
| 'react-intl': '^7.1.14', | ||
| 'react-query': '^3.39.3', | ||
| 'react-redux': '^8.1', | ||
| 'react-router': '^5.2.0', | ||
| 'react-router-dom': '^5.2.0', | ||
| 'redux-observable': '^1.2.0', | ||
| 'rxjs': '^6.6.3', | ||
| }; | ||
|
|
||
| /** getHostAppSingletons | ||
| * get singletons from stripes-core package.json on Github. | ||
| */ | ||
| const getHostAppSingletons = () => { | ||
| let platformSingletons = {}; | ||
|
|
||
| const handlePkgData = (corePkg) => { | ||
| const pkgObject = corePkg.data ? JSON.parse(corePkg.data) : corePkg; | ||
| const stripesCoreVersion = pkgObject.version; | ||
| platformSingletons['@folio/stripes-core'] = `~${stripesCoreVersion}`; | ||
| Object.keys(singletons).forEach(dep => { | ||
| const depVersion = pkgObject.peerDependencies[dep]; | ||
| if (depVersion) { | ||
| platformSingletons[dep] = depVersion; | ||
| } | ||
| }); | ||
| platformSingletons = { ...platformSingletons, ...singletons }; | ||
| } | ||
|
|
||
| let corePkg; | ||
| // try to get the locally installed stripes-core | ||
| try { | ||
| corePkg = require('@folio/stripes-core/package.json'); | ||
| } catch (e) { | ||
| corePkg = singletons; | ||
| throw new Error('Error retrieving singletons list from platform. Falling back to static list'); | ||
| } | ||
|
|
||
| handlePkgData(corePkg); | ||
| return platformSingletons; | ||
| } | ||
|
|
||
| const defaultentitlementUrl = 'http://localhost:3001/registry'; | ||
|
|
||
| module.exports = { | ||
| defaultentitlementUrl, | ||
|
Member
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. petty: |
||
| singletons, | ||
| getHostAppSingletons | ||
| }; | ||
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.
Extremely very petty: just * not * *