Skip to content

Commit 5f56828

Browse files
committed
chore: patch frontend-build deployment
1 parent 23e522e commit 5f56828

File tree

3 files changed

+167
-0
lines changed

3 files changed

+167
-0
lines changed

package-lock.json

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
1616
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
1717
"prepare": "husky install",
18+
"postinstall": "patch-package",
1819
"snapshot": "fedx-scripts jest --updateSnapshot",
1920
"start": "fedx-scripts webpack-dev-server --progress",
2021
"test": "fedx-scripts jest --coverage --passWithNoTests"
@@ -84,6 +85,7 @@
8485
"jest": "^26.6.3",
8586
"jest-console-group-reporter": "^1.0.1",
8687
"jest-when": "^3.6.0",
88+
"patch-package": "^8.0.0",
8789
"postcss-loader": "^8.1.1",
8890
"rosie": "2.1.1",
8991
"sass": "^1.72.0",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/node_modules/@openedx/frontend-build/config/webpack.prod.config.js b/node_modules/@openedx/frontend-build/config/webpack.prod.config.js
2+
index 2879dd9..9efd0fc 100644
3+
--- a/node_modules/@openedx/frontend-build/config/webpack.prod.config.js
4+
+++ b/node_modules/@openedx/frontend-build/config/webpack.prod.config.js
5+
@@ -12,6 +12,7 @@ const NewRelicSourceMapPlugin = require('@edx/new-relic-source-map-webpack-plugi
6+
const HtmlWebpackPlugin = require('html-webpack-plugin');
7+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
8+
const path = require('path');
9+
+const fs = require('fs');
10+
const PostCssAutoprefixerPlugin = require('autoprefixer');
11+
const PostCssRTLCSS = require('postcss-rtlcss');
12+
const PostCssCustomMediaCSS = require('postcss-custom-media');
13+
@@ -23,6 +24,23 @@ const HtmlWebpackNewRelicPlugin = require('../lib/plugins/html-webpack-new-relic
14+
const commonConfig = require('./webpack.common.config');
15+
const presets = require('../lib/presets');
16+
17+
+/**
18+
+ * This condition confirms whether the configuration for the MFE has switched to a JS-based configuration
19+
+ * as previously implemented in frontend-build and frontend-platform. If the environment variable JS_CONFIG_FILEPATH
20+
+ * exists, then an env.config.js(x) file will be copied from the location referenced by the environment variable to the
21+
+ * root directory. Its env variables can be accessed with getConfig().
22+
+ *
23+
+ * https://github.com/openedx/frontend-build/blob/master/docs/0002-js-environment-config.md
24+
+ * https://github.com/openedx/frontend-platform/blob/master/docs/decisions/0007-javascript-file-configuration.rst
25+
+ */
26+
+
27+
+const envConfigPath = process.env.JS_CONFIG_FILEPATH;
28+
+
29+
+if (envConfigPath) {
30+
+ const envConfigFilename = envConfigPath.slice(envConfigPath.indexOf('env.config'));
31+
+ fs.copyFileSync(envConfigPath, envConfigFilename);
32+
+}
33+
+
34+
// Add process env vars. Currently used only for setting the PUBLIC_PATH.
35+
dotenv.config({
36+
path: path.resolve(process.cwd(), '.env'),

0 commit comments

Comments
 (0)