@openedx/frontend-base 1.0.0-alpha.0 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/types.js +0 -2
- package/config/webpack/plugins/html-webpack-new-relic-plugin/test/HtmlWebpackNewRelicPlugin.test.js +66 -0
- package/package.json +8 -1
- package/runtime/__mocks__/file.js +1 -0
- package/runtime/__mocks__/svg.js +1 -0
- package/runtime/__mocks__/universal-cookie.js +6 -0
- package/runtime/analytics/interface.test.js +242 -0
- package/runtime/auth/AxiosJwtAuthService.test.jsx +1076 -0
- package/runtime/auth/interceptors/createRetryInterceptor.test.js +23 -0
- package/runtime/config/getExternalLinkUrl.test.js +76 -0
- package/runtime/i18n/lib.test.js +230 -0
- package/runtime/initialize.async.function.config.test.js +43 -0
- package/runtime/initialize.const.config.test.js +41 -0
- package/runtime/initialize.function.config.test.js +41 -0
- package/runtime/initialize.test.js +356 -0
- package/runtime/logging/NewRelicLoggingService.test.js +214 -0
- package/runtime/react/AuthenticatedPageRoute.test.jsx +135 -0
- package/runtime/react/ErrorBoundary.test.jsx +83 -0
- package/runtime/react/SiteProvider.test.jsx +66 -0
- package/runtime/react/hooks.test.jsx +104 -0
- package/runtime/routing/utils.test.ts +7 -0
- package/runtime/scripts/GoogleAnalyticsLoader.test.ts +77 -0
- package/runtime/site.config.test.tsx +33 -0
- package/runtime/slots/Slot.test.tsx +40 -0
- package/runtime/slots/layout/DefaultSlotLayout.test.tsx +31 -0
- package/runtime/slots/layout/hooks.test.tsx +178 -0
- package/runtime/slots/layout/utils.test.ts +67 -0
- package/runtime/slots/types.ts +1 -0
- package/runtime/slots/utils.test.ts +64 -0
- package/runtime/slots/utils.ts +28 -9
- package/runtime/testing/initializeMockApp.test.ts +66 -0
- package/runtime/utils.test.js +116 -0
- package/shell/Logo.test.tsx +32 -0
- package/shell/__mocks__/file.js +1 -0
- package/shell/__mocks__/svg.js +1 -0
- package/shell/__mocks__/universal-cookie.js +6 -0
- package/shell/app.ts +14 -0
- package/shell/dev/devHome/app.ts +2 -2
- package/shell/dev/slotShowcase/app.tsx +9 -9
- package/shell/header/app.tsx +3 -3
- package/shell/router/createRouter.test.tsx +50 -0
- package/shell/router/getAppRoutes.test.tsx +59 -0
- package/shell/site.config.dev.tsx +3 -3
- package/shell/site.config.test.tsx +16 -0
- package/tools/dist/cli/intl-imports.test.js +146 -0
- package/tools/dist/cli/openedx.js +1 -15
- package/tools/dist/cli/utils/printUsage.js +0 -9
- package/tools/dist/types.js +0 -2
- package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/test/HtmlWebpackNewRelicPlugin.test.js +66 -0
- package/types.ts +1 -1
- package/eslint.config.js +0 -18
- package/frontend-base.d.ts +0 -8
- package/jest.config.js +0 -7
- package/openedx-frontend-base.tgz +0 -0
- package/test-site/app.d.ts +0 -15
- package/test-site/dist/176.436443549ebb858db483.js +0 -2
- package/test-site/dist/176.436443549ebb858db483.js.map +0 -1
- package/test-site/dist/362.536eff787d2380fe246c.js +0 -2
- package/test-site/dist/362.536eff787d2380fe246c.js.map +0 -1
- package/test-site/dist/653.486966b108d224551296.js +0 -2
- package/test-site/dist/653.486966b108d224551296.js.map +0 -1
- package/test-site/dist/74e025d3fe9a7b7f8503054e2563b353.jpg +0 -0
- package/test-site/dist/806.323cf6496ad0a7fe73a7.js +0 -3
- package/test-site/dist/806.323cf6496ad0a7fe73a7.js.LICENSE.txt +0 -106
- package/test-site/dist/806.323cf6496ad0a7fe73a7.js.map +0 -1
- package/test-site/dist/95ec738c0b7faac5b5c9126794446bbd.svg +0 -4
- package/test-site/dist/app.612058b36c74787759ac.css +0 -61
- package/test-site/dist/app.612058b36c74787759ac.css.map +0 -1
- package/test-site/dist/app.612058b36c74787759ac.js +0 -2
- package/test-site/dist/app.612058b36c74787759ac.js.map +0 -1
- package/test-site/dist/cb28cdb1468c915e27e5cec9af64f22f.svg +0 -1
- package/test-site/dist/index.html +0 -1
- package/test-site/dist/report.html +0 -39
- package/test-site/dist/runtime.c7aeaf7b967496cb076f.js +0 -2
- package/test-site/dist/runtime.c7aeaf7b967496cb076f.js.map +0 -1
- package/test-site/eslint.config.js +0 -12
- package/test-site/package-lock.json +0 -19226
- package/test-site/package.json +0 -29
- package/test-site/public/index.html +0 -10
- package/test-site/site.config.build.tsx +0 -27
- package/test-site/site.config.dev.tsx +0 -27
- package/test-site/src/authenticated-page/AuthenticatedPage.tsx +0 -18
- package/test-site/src/authenticated-page/i18n/index.ts +0 -27
- package/test-site/src/authenticated-page/index.tsx +0 -28
- package/test-site/src/example-page/ExamplePage.tsx +0 -79
- package/test-site/src/example-page/Image.tsx +0 -11
- package/test-site/src/example-page/ParagonPreview.jsx +0 -66
- package/test-site/src/example-page/apple.jpg +0 -0
- package/test-site/src/example-page/apple.svg +0 -1
- package/test-site/src/example-page/index.ts +0 -16
- package/test-site/src/i18n/README.md +0 -3
- package/test-site/src/i18n/messages/frontend-app-sample/ar.json +0 -4
- package/test-site/src/i18n/messages/frontend-app-sample/eo.json +0 -1
- package/test-site/src/i18n/messages/frontend-app-sample/es_419.json +0 -4
- package/test-site/src/i18n/messages/frontend-component-emptylangs/ar.json +0 -1
- package/test-site/src/i18n/messages/frontend-component-singlelang/ar.json +0 -3
- package/test-site/src/iframe-widget/IframeWidget.tsx +0 -14
- package/test-site/src/iframe-widget/index.ts +0 -16
- package/test-site/src/index.tsx +0 -3
- package/test-site/src/messages.js +0 -11
- package/test-site/src/site.scss +0 -11
- package/test-site/tsconfig.json +0 -14
- package/tools/babel/babel.config.js +0 -27
- package/tools/babel.config.js +0 -3
- package/tools/cli/README.md +0 -29
- package/tools/cli/commands/pack.ts +0 -9
- package/tools/cli/commands/release.ts +0 -27
- package/tools/cli/commands/serve.ts +0 -43
- package/tools/cli/intl-imports.ts +0 -274
- package/tools/cli/openedx.ts +0 -101
- package/tools/cli/transifex-utils.ts +0 -75
- package/tools/cli/utils/ensureConfigFilenameOption.ts +0 -40
- package/tools/cli/utils/formatter.ts +0 -10
- package/tools/cli/utils/getResolvedConfigPath.ts +0 -23
- package/tools/cli/utils/prettyPrintTitle.ts +0 -15
- package/tools/cli/utils/printUsage.ts +0 -53
- package/tools/config-helpers/createConfig.ts +0 -8
- package/tools/config-helpers/createLintConfig.ts +0 -14
- package/tools/config-helpers/getBaseConfig.ts +0 -11
- package/tools/defaultConfigPaths.ts +0 -30
- package/tools/dist/cli/commands/pack.js +0 -14
- package/tools/dist/cli/commands/release.js +0 -28
- package/tools/eslint/base.eslint.config.js +0 -124
- package/tools/eslint/modules.d.ts +0 -5
- package/tools/eslint.config.js +0 -15
- package/tools/index.ts +0 -3
- package/tools/jest/jest.config.js +0 -30
- package/tools/jest.config.js +0 -19
- package/tools/tsconfig.json +0 -24
- package/tools/types.ts +0 -21
- package/tools/typescript/tsconfig.json +0 -32
- package/tools/webpack/common-config/README.md +0 -15
- package/tools/webpack/common-config/all/getCodeRules.ts +0 -51
- package/tools/webpack/common-config/all/getFileLoaderRules.ts +0 -23
- package/tools/webpack/common-config/all/getIgnoreWarnings.ts +0 -13
- package/tools/webpack/common-config/all/getImageMinimizer.ts +0 -26
- package/tools/webpack/common-config/all/getStylesheetRule.ts +0 -111
- package/tools/webpack/common-config/dev/getDevServer.ts +0 -35
- package/tools/webpack/common-config/index.ts +0 -6
- package/tools/webpack/common-config/site/getHtmlWebpackPlugin.ts +0 -11
- package/tools/webpack/modules.d.ts +0 -6
- package/tools/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.ts +0 -102
- package/tools/webpack/plugins/html-webpack-new-relic-plugin/LICENSE +0 -21
- package/tools/webpack/plugins/html-webpack-new-relic-plugin/README.md +0 -7
- package/tools/webpack/plugins/html-webpack-new-relic-plugin/index.js +0 -3
- package/tools/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +0 -1
- package/tools/webpack/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.ts +0 -134
- package/tools/webpack/plugins/paragon-webpack-plugin/index.ts +0 -3
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/assetUtils.ts +0 -71
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/htmlUtils.ts +0 -72
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/index.ts +0 -6
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.ts +0 -131
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/scriptUtils.ts +0 -144
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/stylesheetUtils.ts +0 -106
- package/tools/webpack/plugins/paragon-webpack-plugin/utils/tagUtils.ts +0 -54
- package/tools/webpack/types.ts +0 -69
- package/tools/webpack/utils/getLocalAliases.ts +0 -65
- package/tools/webpack/utils/getPublicPath.ts +0 -3
- package/tools/webpack/utils/getResolvedSiteConfigPath.ts +0 -28
- package/tools/webpack/utils/paragonUtils.ts +0 -152
- package/tools/webpack/webpack.config.build.ts +0 -93
- package/tools/webpack/webpack.config.dev.shell.ts +0 -122
- package/tools/webpack/webpack.config.dev.ts +0 -90
- package/tsconfig.json +0 -23
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
2
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { Configuration } from 'webpack';
|
|
5
|
-
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
6
|
-
import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
getCodeRules,
|
|
10
|
-
getFileLoaderRules,
|
|
11
|
-
getHtmlWebpackPlugin,
|
|
12
|
-
getImageMinimizer,
|
|
13
|
-
getStylesheetRule
|
|
14
|
-
} from './common-config';
|
|
15
|
-
|
|
16
|
-
import ParagonWebpackPlugin from './plugins/paragon-webpack-plugin/ParagonWebpackPlugin';
|
|
17
|
-
|
|
18
|
-
import getLocalAliases from './utils/getLocalAliases';
|
|
19
|
-
import getPublicPath from './utils/getPublicPath';
|
|
20
|
-
import getResolvedSiteConfigPath from './utils/getResolvedSiteConfigPath';
|
|
21
|
-
import {
|
|
22
|
-
getParagonCacheGroups,
|
|
23
|
-
getParagonEntryPoints,
|
|
24
|
-
getParagonThemeCss,
|
|
25
|
-
} from './utils/paragonUtils';
|
|
26
|
-
|
|
27
|
-
const paragonThemeCss = getParagonThemeCss(process.cwd());
|
|
28
|
-
const brandThemeCss = getParagonThemeCss(process.cwd(), { isBrandOverride: true });
|
|
29
|
-
const aliases = getLocalAliases();
|
|
30
|
-
const resolvedSiteConfigPath = getResolvedSiteConfigPath('site.config.build.tsx');
|
|
31
|
-
|
|
32
|
-
const config: Configuration = {
|
|
33
|
-
mode: 'production',
|
|
34
|
-
devtool: 'source-map',
|
|
35
|
-
entry: {
|
|
36
|
-
app: path.resolve(process.cwd(), 'node_modules/@openedx/frontend-base/shell/site'),
|
|
37
|
-
...getParagonEntryPoints(paragonThemeCss),
|
|
38
|
-
...getParagonEntryPoints(brandThemeCss),
|
|
39
|
-
},
|
|
40
|
-
output: {
|
|
41
|
-
filename: '[name].[chunkhash].js',
|
|
42
|
-
path: path.resolve(process.cwd(), 'dist'),
|
|
43
|
-
publicPath: getPublicPath(),
|
|
44
|
-
clean: true, // Clean the output directory before emit.
|
|
45
|
-
},
|
|
46
|
-
resolve: {
|
|
47
|
-
alias: {
|
|
48
|
-
...aliases,
|
|
49
|
-
'site.config': resolvedSiteConfigPath,
|
|
50
|
-
},
|
|
51
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
52
|
-
},
|
|
53
|
-
module: {
|
|
54
|
-
rules: [
|
|
55
|
-
...getCodeRules('production', resolvedSiteConfigPath),
|
|
56
|
-
getStylesheetRule('production'),
|
|
57
|
-
...getFileLoaderRules(),
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
// Extract common modules among all chunks to one common chunk and extract the Webpack runtime to a single runtime chunk.
|
|
61
|
-
optimization: {
|
|
62
|
-
runtimeChunk: 'single',
|
|
63
|
-
splitChunks: {
|
|
64
|
-
chunks: 'all',
|
|
65
|
-
cacheGroups: {
|
|
66
|
-
...getParagonCacheGroups(paragonThemeCss),
|
|
67
|
-
...getParagonCacheGroups(brandThemeCss),
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
minimizer: getImageMinimizer(),
|
|
71
|
-
},
|
|
72
|
-
// Specify additional processing or side-effects done on the Webpack output bundles as a whole.
|
|
73
|
-
plugins: [
|
|
74
|
-
// RemoveEmptyScriptsPlugin get rid of empty scripts generated by webpack when using mini-css-extract-plugin
|
|
75
|
-
// This helps to clean up the final bundle application
|
|
76
|
-
// See: https://www.npmjs.com/package/webpack-remove-empty-scripts#usage-with-mini-css-extract-plugin
|
|
77
|
-
|
|
78
|
-
new RemoveEmptyScriptsPlugin(),
|
|
79
|
-
// Writes the extracted CSS from each entry to a file in the output directory.
|
|
80
|
-
new ParagonWebpackPlugin(),
|
|
81
|
-
new MiniCssExtractPlugin({
|
|
82
|
-
filename: '[name].[chunkhash].css',
|
|
83
|
-
}),
|
|
84
|
-
getHtmlWebpackPlugin(),
|
|
85
|
-
new ForkTsCheckerWebpackPlugin(),
|
|
86
|
-
new BundleAnalyzerPlugin({
|
|
87
|
-
analyzerMode: 'static',
|
|
88
|
-
openAnalyzer: false,
|
|
89
|
-
}),
|
|
90
|
-
],
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default config;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { transform } from '@formatjs/ts-transformer';
|
|
2
|
-
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
3
|
-
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
4
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import ReactRefreshTypeScript from 'react-refresh-typescript';
|
|
7
|
-
import { Configuration } from 'webpack';
|
|
8
|
-
import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
getDevServer,
|
|
12
|
-
getFileLoaderRules,
|
|
13
|
-
getImageMinimizer,
|
|
14
|
-
getStylesheetRule
|
|
15
|
-
} from './common-config';
|
|
16
|
-
|
|
17
|
-
import ParagonWebpackPlugin from './plugins/paragon-webpack-plugin/ParagonWebpackPlugin';
|
|
18
|
-
|
|
19
|
-
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
20
|
-
import getLocalAliases from './utils/getLocalAliases';
|
|
21
|
-
import getPublicPath from './utils/getPublicPath';
|
|
22
|
-
import getResolvedSiteConfigPath from './utils/getResolvedSiteConfigPath';
|
|
23
|
-
import {
|
|
24
|
-
getParagonCacheGroups,
|
|
25
|
-
getParagonEntryPoints,
|
|
26
|
-
getParagonThemeCss,
|
|
27
|
-
} from './utils/paragonUtils';
|
|
28
|
-
|
|
29
|
-
const paragonThemeCss = getParagonThemeCss(process.cwd());
|
|
30
|
-
const brandThemeCss = getParagonThemeCss(process.cwd(), { isBrandOverride: true });
|
|
31
|
-
const aliases = getLocalAliases();
|
|
32
|
-
const resolvedSiteConfigPath = getResolvedSiteConfigPath('shell/site.config.dev.tsx');
|
|
33
|
-
|
|
34
|
-
const config: Configuration = {
|
|
35
|
-
entry: {
|
|
36
|
-
app: path.resolve(process.cwd(), 'shell/site'),
|
|
37
|
-
...getParagonEntryPoints(paragonThemeCss),
|
|
38
|
-
...getParagonEntryPoints(brandThemeCss),
|
|
39
|
-
},
|
|
40
|
-
output: {
|
|
41
|
-
path: path.resolve(process.cwd(), './dist'),
|
|
42
|
-
publicPath: getPublicPath(),
|
|
43
|
-
},
|
|
44
|
-
resolve: {
|
|
45
|
-
alias: {
|
|
46
|
-
...aliases,
|
|
47
|
-
'site.config': resolvedSiteConfigPath,
|
|
48
|
-
},
|
|
49
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
50
|
-
},
|
|
51
|
-
mode: 'development',
|
|
52
|
-
devtool: 'eval-source-map',
|
|
53
|
-
module: {
|
|
54
|
-
rules: [
|
|
55
|
-
{
|
|
56
|
-
test: /\.(js|jsx|ts|tsx)$/,
|
|
57
|
-
include: [
|
|
58
|
-
/shell/,
|
|
59
|
-
/runtime/,
|
|
60
|
-
path.resolve(process.cwd(), 'types'),
|
|
61
|
-
resolvedSiteConfigPath,
|
|
62
|
-
],
|
|
63
|
-
use: {
|
|
64
|
-
loader: require.resolve('ts-loader'),
|
|
65
|
-
options: {
|
|
66
|
-
transpileOnly: true,
|
|
67
|
-
compilerOptions: {
|
|
68
|
-
noEmit: false,
|
|
69
|
-
},
|
|
70
|
-
getCustomTransformers() {
|
|
71
|
-
return {
|
|
72
|
-
before: [
|
|
73
|
-
transform({
|
|
74
|
-
overrideIdFn: '[sha512:contenthash:base64:6]',
|
|
75
|
-
}),
|
|
76
|
-
ReactRefreshTypeScript()
|
|
77
|
-
],
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
getStylesheetRule('dev'),
|
|
84
|
-
...getFileLoaderRules(),
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
optimization: {
|
|
88
|
-
splitChunks: {
|
|
89
|
-
chunks: 'all',
|
|
90
|
-
cacheGroups: {
|
|
91
|
-
...getParagonCacheGroups(paragonThemeCss),
|
|
92
|
-
...getParagonCacheGroups(brandThemeCss),
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
minimizer: getImageMinimizer(),
|
|
96
|
-
},
|
|
97
|
-
// Specify additional processing or side-effects done on the Webpack output bundles as a whole.
|
|
98
|
-
plugins: [
|
|
99
|
-
// RemoveEmptyScriptsPlugin get rid of empty scripts generated by webpack when using mini-css-extract-plugin
|
|
100
|
-
// This helps to clean up the final bundle application
|
|
101
|
-
// See: https://www.npmjs.com/package/webpack-remove-empty-scripts#usage-with-mini-css-extract-plugin
|
|
102
|
-
new RemoveEmptyScriptsPlugin(),
|
|
103
|
-
new ParagonWebpackPlugin(),
|
|
104
|
-
// Writes the extracted CSS from each entry to a file in the output directory.
|
|
105
|
-
new MiniCssExtractPlugin({
|
|
106
|
-
filename: '[name].css',
|
|
107
|
-
}),
|
|
108
|
-
new HtmlWebpackPlugin({
|
|
109
|
-
inject: true, // Appends script tags linking to the webpack bundles at the end of the body
|
|
110
|
-
template: path.resolve(process.cwd(), 'shell/public/index.html'),
|
|
111
|
-
chunks: ['app'],
|
|
112
|
-
}),
|
|
113
|
-
new ReactRefreshWebpackPlugin(),
|
|
114
|
-
new ForkTsCheckerWebpackPlugin(),
|
|
115
|
-
],
|
|
116
|
-
// This configures webpack-dev-server which serves bundles from memory and provides live
|
|
117
|
-
// reloading.
|
|
118
|
-
|
|
119
|
-
devServer: getDevServer(),
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export default config;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
2
|
-
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
3
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { Configuration } from 'webpack';
|
|
6
|
-
import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
getCodeRules,
|
|
10
|
-
getDevServer,
|
|
11
|
-
getFileLoaderRules,
|
|
12
|
-
getHtmlWebpackPlugin,
|
|
13
|
-
getImageMinimizer,
|
|
14
|
-
getStylesheetRule
|
|
15
|
-
} from './common-config';
|
|
16
|
-
|
|
17
|
-
import ParagonWebpackPlugin from './plugins/paragon-webpack-plugin/ParagonWebpackPlugin';
|
|
18
|
-
|
|
19
|
-
import getLocalAliases from './utils/getLocalAliases';
|
|
20
|
-
import getPublicPath from './utils/getPublicPath';
|
|
21
|
-
import getResolvedSiteConfigPath from './utils/getResolvedSiteConfigPath';
|
|
22
|
-
import {
|
|
23
|
-
getParagonCacheGroups,
|
|
24
|
-
getParagonEntryPoints,
|
|
25
|
-
getParagonThemeCss,
|
|
26
|
-
} from './utils/paragonUtils';
|
|
27
|
-
|
|
28
|
-
const paragonThemeCss = getParagonThemeCss(process.cwd());
|
|
29
|
-
const brandThemeCss = getParagonThemeCss(process.cwd(), { isBrandOverride: true });
|
|
30
|
-
const aliases = getLocalAliases();
|
|
31
|
-
const resolvedSiteConfigPath = getResolvedSiteConfigPath('site.config.dev.tsx');
|
|
32
|
-
|
|
33
|
-
const config: Configuration = {
|
|
34
|
-
entry: {
|
|
35
|
-
app: path.resolve(process.cwd(), 'node_modules/@openedx/frontend-base/shell/site'),
|
|
36
|
-
...getParagonEntryPoints(paragonThemeCss),
|
|
37
|
-
...getParagonEntryPoints(brandThemeCss),
|
|
38
|
-
},
|
|
39
|
-
output: {
|
|
40
|
-
path: path.resolve(process.cwd(), './dist'),
|
|
41
|
-
publicPath: getPublicPath(),
|
|
42
|
-
},
|
|
43
|
-
resolve: {
|
|
44
|
-
alias: {
|
|
45
|
-
...aliases,
|
|
46
|
-
'site.config': resolvedSiteConfigPath,
|
|
47
|
-
},
|
|
48
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
49
|
-
},
|
|
50
|
-
mode: 'development',
|
|
51
|
-
devtool: 'eval-source-map',
|
|
52
|
-
module: {
|
|
53
|
-
rules: [
|
|
54
|
-
...getCodeRules('dev', resolvedSiteConfigPath),
|
|
55
|
-
getStylesheetRule('dev'),
|
|
56
|
-
...getFileLoaderRules(),
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
optimization: {
|
|
60
|
-
splitChunks: {
|
|
61
|
-
chunks: 'all',
|
|
62
|
-
cacheGroups: {
|
|
63
|
-
...getParagonCacheGroups(paragonThemeCss),
|
|
64
|
-
...getParagonCacheGroups(brandThemeCss),
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
minimizer: getImageMinimizer(),
|
|
68
|
-
},
|
|
69
|
-
// Specify additional processing or side-effects done on the Webpack output bundles as a whole.
|
|
70
|
-
plugins: [
|
|
71
|
-
// RemoveEmptyScriptsPlugin get rid of empty scripts generated by webpack when using mini-css-extract-plugin
|
|
72
|
-
// This helps to clean up the final bundle application
|
|
73
|
-
// See: https://www.npmjs.com/package/webpack-remove-empty-scripts#usage-with-mini-css-extract-plugin
|
|
74
|
-
new RemoveEmptyScriptsPlugin(),
|
|
75
|
-
new ParagonWebpackPlugin(),
|
|
76
|
-
// Writes the extracted CSS from each entry to a file in the output directory.
|
|
77
|
-
new MiniCssExtractPlugin({
|
|
78
|
-
filename: '[name].css',
|
|
79
|
-
}),
|
|
80
|
-
getHtmlWebpackPlugin(),
|
|
81
|
-
new ReactRefreshWebpackPlugin(),
|
|
82
|
-
new ForkTsCheckerWebpackPlugin(),
|
|
83
|
-
],
|
|
84
|
-
// This configures webpack-dev-server which serves bundles from memory and provides live
|
|
85
|
-
// reloading.
|
|
86
|
-
|
|
87
|
-
devServer: getDevServer(),
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export default config;
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tools/typescript/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": ".",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
},
|
|
7
|
-
"include": [
|
|
8
|
-
"runtime/**/*",
|
|
9
|
-
"shell/**/*",
|
|
10
|
-
"index.ts",
|
|
11
|
-
"jest.config.js",
|
|
12
|
-
"babel.config.js",
|
|
13
|
-
"eslint.config.js",
|
|
14
|
-
"frontend-base.d.ts",
|
|
15
|
-
],
|
|
16
|
-
"exclude": [
|
|
17
|
-
"test-site/**/*",
|
|
18
|
-
"dist/**/*",
|
|
19
|
-
"coverage/**/*",
|
|
20
|
-
"tools/**/*",
|
|
21
|
-
"config/**/*",
|
|
22
|
-
],
|
|
23
|
-
}
|