Skip to content

Commit

Permalink
chore: wip commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz committed Feb 24, 2023
1 parent eabc2e2 commit e8777c1
Show file tree
Hide file tree
Showing 7 changed files with 1,749 additions and 1,408 deletions.
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ IGNORED_ERROR_REGEX=
MFE_CONFIG_API_URL=
APP_ID=
SUPPORT_URL=https://support.edx.org
APP_THEME_CORE_URL=
APP_THEME_LIGHT_URL=
APP_THEME_CORE_URL='http://localhost:3000/tokens/theme/css/core'
APP_THEME_LIGHT_URL='http://localhost:3000/tokens/theme/css/light'
3 changes: 2 additions & 1 deletion example/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {
import { APP_INIT_ERROR, APP_READY, initialize } from '@edx/frontend-platform';
import { subscribe } from '@edx/frontend-platform/pubSub';

import './index.scss';
import ExamplePage from './ExamplePage';
import AuthenticatedPage from './AuthenticatedPage';

import './index.scss';

subscribe(APP_READY, () => {
ReactDOM.render(
<AppProvider>
Expand Down
3,096 changes: 1,709 additions & 1,387 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@edx/browserslist-config": "1.1.1",
"@edx/brand": "npm:@edx/[email protected]",
"@edx/frontend-build": "12.4.16",
"@edx/frontend-build": "12.5.6",
"@edx/paragon": "20.27.0",
"axios-mock-adapter": "1.21.2",
"core-js": "3.27.2",
Expand Down
4 changes: 2 additions & 2 deletions src/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export async function analytics() {
}

function applyOverrideHandlers(overrides) {
const noOp = async () => { };
const noOp = async () => {};
return {
pubSub: noOp,
config: noOp,
Expand Down Expand Up @@ -211,6 +211,7 @@ function applyOverrideHandlers(overrides) {
* - logging: A no-op by default.
* - auth: Uses the 'auth' handler defined above.
* - analytics: Uses the 'analytics' handler defined above.
* - theme: Uses the 'theme' handler defined above.
* - i18n: A no-op by default.
* - ready: A no-op by default.
* - initError: Uses the 'initError' handler defined above.
Expand Down Expand Up @@ -269,7 +270,6 @@ export async function initialize({
config: getConfig(),
middleware: authMiddleware,
});

await handlers.auth(requireUser, hydrateUser);
publish(APP_AUTH_INITIALIZED);

Expand Down
7 changes: 4 additions & 3 deletions src/react/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const useAppThemeCore = ({
onLoad,
}) => {
useEffect(() => {
// If the config for either the core theme url, do nothing.
// If the config for the core theme url, do nothing.
if (!coreThemeUrl) {
return;
}
Expand All @@ -56,7 +56,7 @@ export const useAppThemeCore = ({
onLoad();
};
document.head.insertAdjacentElement(
'beforeend',
'afterbegin',
coreThemeLink,
);
}
Expand Down Expand Up @@ -117,7 +117,7 @@ const useAppThemeVariants = ({
setThemeVariantLoaded(themeVariant);
};
document.head.insertAdjacentElement(
'beforeend',
'afterbegin',
themeVariantLink,
);
} else if (themeVariantLink.rel !== stylesheetRelForVariant) {
Expand Down Expand Up @@ -175,6 +175,7 @@ export const useAppTheme = ({
useAppThemeVariants({
themeVariantUrls,
onLoadVariantLight: onLoadThemeVariantLight,
currentThemeVariant: appThemeState.themeVariant,
});

useEffect(() => {
Expand Down
41 changes: 29 additions & 12 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
const path = require('path');
const { createConfig } = require('@edx/frontend-build');
const { createConfig, getBaseConfig } = require('@edx/frontend-build');

module.exports = createConfig('webpack-dev', {
entry: path.resolve(__dirname, 'example'),
output: {
path: path.resolve(__dirname, 'example/dist'),
publicPath: '/',
},
resolve: {
alias: {
'@edx/frontend-platform': path.resolve(__dirname, 'src'),
},
// module.exports = createConfig('webpack-dev', {
// entry: path.resolve(__dirname, 'example'),
// output: {
// path: path.resolve(__dirname, 'example/dist'),
// publicPath: '/',
// },
// resolve: {
// alias: {
// '@edx/frontend-platform': path.resolve(__dirname, 'src'),
// },
// },
// });

const config = getBaseConfig('webpack-dev');

config.entry = path.resolve(__dirname, 'example');
config.output = {
...config.output,
path: path.resolve(__dirname, 'example/dist'),
};
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
'@edx/frontend-platform': path.resolve(__dirname, 'src'),
},
});
};

module.exports = config;

0 comments on commit e8777c1

Please sign in to comment.