-
Notifications
You must be signed in to change notification settings - Fork 211
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
chore: patch frontend-build deployment #1350
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff --git a/node_modules/@openedx/frontend-build/config/webpack.prod.config.js b/node_modules/@openedx/frontend-build/config/webpack.prod.config.js | ||
index 2879dd9..9efd0fc 100644 | ||
--- a/node_modules/@openedx/frontend-build/config/webpack.prod.config.js | ||
+++ b/node_modules/@openedx/frontend-build/config/webpack.prod.config.js | ||
@@ -12,6 +12,7 @@ const NewRelicSourceMapPlugin = require('@edx/new-relic-source-map-webpack-plugi | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const path = require('path'); | ||
+const fs = require('fs'); | ||
const PostCssAutoprefixerPlugin = require('autoprefixer'); | ||
const PostCssRTLCSS = require('postcss-rtlcss'); | ||
const PostCssCustomMediaCSS = require('postcss-custom-media'); | ||
@@ -23,6 +24,23 @@ const HtmlWebpackNewRelicPlugin = require('../lib/plugins/html-webpack-new-relic | ||
const commonConfig = require('./webpack.common.config'); | ||
const presets = require('../lib/presets'); | ||
|
||
+/** | ||
+ * This condition confirms whether the configuration for the MFE has switched to a JS-based configuration | ||
+ * as previously implemented in frontend-build and frontend-platform. If the environment variable JS_CONFIG_FILEPATH | ||
+ * exists, then an env.config.js(x) file will be copied from the location referenced by the environment variable to the | ||
+ * root directory. Its env variables can be accessed with getConfig(). | ||
+ * | ||
+ * https://github.com/openedx/frontend-build/blob/master/docs/0002-js-environment-config.md | ||
+ * https://github.com/openedx/frontend-platform/blob/master/docs/decisions/0007-javascript-file-configuration.rst | ||
+ */ | ||
+ | ||
+const envConfigPath = process.env.JS_CONFIG_FILEPATH; | ||
+ | ||
+if (envConfigPath) { | ||
+ const envConfigFilename = envConfigPath.slice(envConfigPath.indexOf('env.config')); | ||
+ fs.copyFileSync(envConfigPath, envConfigFilename); | ||
+} | ||
+ | ||
// Add process env vars. Currently used only for setting the PUBLIC_PATH. | ||
dotenv.config({ | ||
path: path.resolve(process.cwd(), '.env'), |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the intent of using this package for?
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.
patch-package
will try to read@openedx+frontend-build+13.0.30.patch
file after install. If you look at the file@openedx+frontend-build+13.0.30.patch
, it is just tellingnode_module/@openedx/frontend-build
to update specific file. Essentially the change for the that was just sowebpack
would pick upJS_CONFIG_FILEPATH
environment variableThere 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.
Interesting; this does seem pretty complex though. What's the need for injecting this patch code here instead of updating the https://github.com/openedx/frontend-build package?
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.
NVM, I see that this is a temporary fix for that pr in the frontend-build like you mention in the PR description,