Skip to content

Commit

Permalink
refactor: change paragon package name for openedx
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed May 17, 2024
1 parent 047f414 commit 86312c3
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 215 deletions.
10 changes: 5 additions & 5 deletions config/data/paragonUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fs = require('fs');
* @returns {string} Paragon dependency version of the consuming application
*/
function getParagonVersion(dir, { isBrandOverride = false } = {}) {
const npmPackageName = isBrandOverride ? '@edx/brand' : '@edx/paragon';
const npmPackageName = isBrandOverride ? '@edx/brand' : '@openedx/paragon';
const pathToPackageJson = `${dir}/node_modules/${npmPackageName}/package.json`;
if (!fs.existsSync(pathToPackageJson)) {
return undefined;
Expand Down Expand Up @@ -38,12 +38,12 @@ function getParagonVersion(dir, { isBrandOverride = false } = {}) {
*/

/**
* Attempts to extract the Paragon theme CSS from the locally installed `@edx/paragon` package.
* Attempts to extract the Paragon theme CSS from the locally installed `@openedx/paragon` package.
* @param {string} dir Path to directory containing `node_modules`.
* @returns {ParagonThemeCss}
*/
function getParagonThemeCss(dir, { isBrandOverride = false } = {}) {
const npmPackageName = isBrandOverride ? '@edx/brand' : '@edx/paragon';
const npmPackageName = isBrandOverride ? '@edx/brand' : '@openedx/paragon';
const pathToParagonThemeOutput = path.resolve(dir, 'node_modules', npmPackageName, 'dist', 'theme-urls.json');

if (!fs.existsSync(pathToParagonThemeOutput)) {
Expand Down Expand Up @@ -128,8 +128,8 @@ function getParagonCacheGroups(paragonThemeCss) {
* @param {ParagonThemeCss} paragonThemeCss The Paragon theme CSS metadata.
* @returns {Object.<string, string>} The entry points for the Paragon theme CSS. Example: ```
* {
* "paragon.theme.core": "/path/to/node_modules/@edx/paragon/dist/core.min.css",
* "paragon.theme.variants.light": "/path/to/node_modules/@edx/paragon/dist/light.min.css"
* "paragon.theme.core": "/path/to/node_modules/@openedx/paragon/dist/core.min.css",
* "paragon.theme.variants.light": "/path/to/node_modules/@openedx/paragon/dist/light.min.css"
* }
* ```
*/
Expand Down
4 changes: 2 additions & 2 deletions config/webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports = {
/**
* The entry points for the Paragon theme CSS. Example: ```
* {
* "paragon.theme.core": "/path/to/node_modules/@edx/paragon/dist/core.min.css",
* "paragon.theme.variants.light": "/path/to/node_modules/@edx/paragon/dist/light.min.css"
* "paragon.theme.core": "/path/to/node_modules/@openedx/paragon/dist/core.min.css",
* "paragon.theme.variants.light": "/path/to/node_modules/@openedx/paragon/dist/light.min.css"
* }
*/
...getParagonEntryPoints(paragonThemeCss),
Expand Down
9 changes: 1 addition & 8 deletions config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { merge } = require('webpack-merge');
const Dotenv = require('dotenv-webpack');
const dotenv = require('dotenv');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const PostCssAutoprefixerPlugin = require('autoprefixer');
Expand All @@ -17,12 +16,6 @@ const presets = require('../lib/presets');
const resolvePrivateEnvConfig = require('../lib/resolvePrivateEnvConfig');
const getLocalAliases = require('./getLocalAliases');

// Add process env vars. Currently used only for setting the
// server port and the publicPath
dotenv.config({
path: path.resolve(process.cwd(), '.env.development'),
});

// Allow private/local overrides of env vars from .env.development for config settings
// that you'd like to persist locally during development, without the risk of checking
// in temporary modifications to .env.development.
Expand Down Expand Up @@ -109,7 +102,7 @@ module.exports = merge(commonConfig, {
test: /(.scss|.css)$/,
oneOf: [
{
resource: /(@edx\/paragon|@edx\/brand)/,
resource: /(@openedx\/paragon|@edx\/brand)/,
use: [
MiniCssExtractPlugin.loader,
...getStyleUseConfig(),
Expand Down
Loading

0 comments on commit 86312c3

Please sign in to comment.