Skip to content

Commit

Permalink
feat: upgrade to frontend-platform (#31)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This package now depends on frontend-platform instead of individual runway packages
  • Loading branch information
Adam Butterworth authored Nov 21, 2019
1 parent 227c754 commit b503643
Show file tree
Hide file tree
Showing 8 changed files with 590 additions and 599 deletions.
14 changes: 8 additions & 6 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import 'babel-polyfill';

import React from 'react';
import ReactDOM from 'react-dom';
import { App, AppContext, APP_READY, AppProvider } from '@edx/frontend-base';
import { NewRelicLoggingService } from '@edx/frontend-logging';
import { initialize, APP_READY } from '@edx/frontend-platform/init';
import { getConfig } from '@edx/frontend-platform/config';
import { AppContext, AppProvider } from '@edx/frontend-platform/react';
import { subscribe } from '@edx/frontend-platform/pubSub';
import './index.scss';
import Header from '../src/';

App.subscribe(APP_READY, () => {
subscribe(APP_READY, () => {
ReactDOM.render(
<AppProvider>
{/* We can fake out authentication by including another provider here with the data we want */}
<AppContext.Provider value={{
authenticatedUser: null,
config: App.config
config: getConfig(),
}}>
<Header />
</AppContext.Provider>
Expand All @@ -27,7 +29,7 @@ App.subscribe(APP_READY, () => {
roles: [],
administrator: false,
},
config: App.config
config: getConfig(),
}}>
<Header />
</AppContext.Provider>
Expand All @@ -37,6 +39,6 @@ App.subscribe(APP_READY, () => {
);
});

App.initialize({
initialize({
messages: []
});
1,144 changes: 570 additions & 574 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@
"@commitlint/config-angular": "8.2.0",
"@commitlint/prompt": "8.2.0",
"@commitlint/prompt-cli": "8.2.0",
"@edx/frontend-analytics": "3.0.0",
"@edx/frontend-auth": "7.0.1",
"@edx/frontend-base": "^5.0.0",
"@edx/frontend-build": "^1.3.1",
"@edx/frontend-i18n": "3.0.3",
"@edx/frontend-logging": "3.0.1",
"@edx/frontend-build": "^2.0.1",
"@edx/frontend-platform": "git+https://github.com/edx/frontend-platform.git",
"@edx/paragon": "7.1.4",
"codecov": "3.6.1",
"enzyme": "3.10.0",
Expand All @@ -65,10 +61,7 @@
"react-transition-group": "4.3.0"
},
"peerDependencies": {
"@edx/frontend-analytics": "^3.0.0",
"@edx/frontend-base": "^4.0.0",
"@edx/frontend-i18n": "^3.0.3",
"@edx/frontend-logging": "^3.0.0",
"@edx/frontend-platform": "^1.0.0",
"@edx/paragon": "^7.0.0",
"prop-types": "^15.5.10",
"react": "^16.9.0",
Expand Down
2 changes: 1 addition & 1 deletion src/DesktopHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-i18n';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';

// Local Components
import { Menu, MenuTrigger, MenuContent } from './Menu';
Expand Down
7 changes: 4 additions & 3 deletions src/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useContext } from 'react';
import Responsive from 'react-responsive';
import { injectIntl, intlShape } from '@edx/frontend-i18n';
import { App, AppContext } from '@edx/frontend-base';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { AppContext } from '@edx/frontend-platform/react';
import { ensureConfig } from '@edx/frontend-platform/config';

import DesktopHeader from './DesktopHeader';
import MobileHeader from './MobileHeader';
Expand All @@ -10,7 +11,7 @@ import LogoSVG from './logo.svg';

import messages from './Header.messages';

App.ensureConfig([
ensureConfig([
'LMS_BASE_URL',
'LOGOUT_URL',
'LOGIN_URL',
Expand Down
2 changes: 1 addition & 1 deletion src/Header.messages.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineMessages } from '@edx/frontend-i18n';
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
'header.links.courses': {
Expand Down
5 changes: 2 additions & 3 deletions src/Header.test.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

import React from 'react';
import { IntlProvider } from '@edx/frontend-i18n';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import TestRenderer from 'react-test-renderer';
import { AppContext } from '@edx/frontend-base';
import { AppContext } from '@edx/frontend-platform/react';
import { Context as ResponsiveContext } from 'react-responsive';

import Header from './index';
Expand Down
2 changes: 1 addition & 1 deletion src/MobileHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-i18n';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';

// Local Components
import { Menu, MenuTrigger, MenuContent } from './Menu';
Expand Down

0 comments on commit b503643

Please sign in to comment.