You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no need for a distinct ProjectSiteConfig; it is actually less
confusing to accept that some config properties are indeed optional, and
write code accordingly.
The concept of "Project" is also a bit confusing, since the
configuration is typed as "SiteConfig". So we're abandoning "Project"
in favor of "Site". This renames everything accordingly.
Continuing, rename SiteConfig's top-level `appId` to a more fitting
`siteId`, leaving `appId` exclusively for the `App` type.
In yet another rename, move the `custom` app config to what it's
actually for: `standalone` mode. (Plus, "dev.legacy" is better
described as "dev.standalone".)
Also move test.site.config.tsx into the normal site.config.*.tsx
pattern. There is no longer any reason for the distinction, as all
site.config files are ok to be committed.
Finally, adjust other webpack and site.config file names to a more
conformant pattern.
@@ -182,7 +182,7 @@ Create an `app.d.ts` file in the root of your MFE with the following contents:
182
182
/// <referencetypes="@openedx/frontend-base" />
183
183
184
184
declaremodule'site.config' {
185
-
exportdefaultProjectSiteConfig;
185
+
exportdefaultSiteConfig;
186
186
}
187
187
188
188
declaremodule'*.svg' {
@@ -210,7 +210,6 @@ Create a `tsconfig.json` file and add the following contents to it:
210
210
"babel.config.js",
211
211
"eslint.config.js",
212
212
"jest.config.js",
213
-
"test.site.config.tsx",
214
213
"site.config.*.tsx",
215
214
],
216
215
}
@@ -388,7 +387,7 @@ Description fields are now required on all i18n messages in the repository. Thi
388
387
SVGR "ReactComponent" imports have been removed
389
388
===============================================
390
389
391
-
We have removed the `@svgr/webpack` loader because it was incompatible with more modern tooling (it requires Babel). As a result, the ability to import SVG files into JS as the `ReactComponent` export no longer works. We know of a total of 5 places where this is happening today in Open edX MFEs - frontend-app-learning and frontend-app-profile use it. Please replace that export with the default URL export and set the URL as the source of an `<img>` tag, rather than using `ReactComponent`. You can see an example of normal SVG imports in `test-project/src/ExamplePage.tsx`.
390
+
We have removed the `@svgr/webpack` loader because it was incompatible with more modern tooling (it requires Babel). As a result, the ability to import SVG files into JS as the `ReactComponent` export no longer works. We know of a total of 5 places where this is happening today in Open edX MFEs - frontend-app-learning and frontend-app-profile use it. Please replace that export with the default URL export and set the URL as the source of an `<img>` tag, rather than using `ReactComponent`. You can see an example of normal SVG imports in `test-site/src/ExamplePage.tsx`.
392
391
393
392
394
393
Import createConfig and getBaseConfig from @openedx/frontend-base/config
@@ -490,7 +489,7 @@ Required config
490
489
491
490
The required configuration at the time of this writing is:
App-specific configuration can be expressed by adding a `custom` section to SiteConfig which allows arbitrary config variables.
540
+
App-specific configuration can be expressed by adding a `standalone` section to SiteConfig which allows arbitrary config variables.
542
541
543
542
```
544
-
const config: ProjectSiteConfig = {
543
+
const config: SiteConfig = {
545
544
// ... Other config
546
545
547
-
custom: {
546
+
standalone: {
548
547
appId: 'myapp',
549
548
myCustomVariableName: 'my custom variable value',
550
549
}
@@ -557,30 +556,28 @@ These variables can be used in code with the `getAppConfig` function:
557
556
getAppConfig('myapp').myCustomVariableName
558
557
```
559
558
560
-
If you have fully converted your app over to the new module architecture, you can add custom variables to the `config` object in your `App` definition and they will be available via `getAppConfig`.
559
+
If you have fully converted your app over to the new architecture, you can add custom variables to the `config` object in your `App` definition and they will be available via `getAppConfig`.
561
560
562
561
563
-
Replace the .env.test file with configuration in test.site.config.tsx file
562
+
Replace the .env.test file with configuration in site.config.test.tsx file
We're moving away from .env files because they're not expressive enough (only string types!) to configure an Open edX frontend. Instead, the test suite has been configured to expect a `test.site.config.tsx` file. If you're initializing an application in your tests, `frontend-base` will pick up this configuration and make it available to `getConfig()`, etc. If you need to manually access the variables, you can import `site.config` in your test files:
567
-
568
-
Note that test.site.config.tsx has a different naming scheme than `site.config.*.tsx` because it's intended to be checked in, and `site.config.*.tsx` is git-ignored.
565
+
We're moving away from .env files because they're not expressive enough (only string types!) to configure an Open edX frontend. Instead, the test suite has been configured to expect a `site.config.test.tsx` file. If you're initializing an application in your tests, `frontend-base` will pick up this configuration and make it available to `getConfig()`, etc. If you need to manually access the variables, you can import `site.config` in your test files:
569
566
570
567
```diff
571
568
+ import config from 'site.config';
572
569
```
573
570
574
-
The Jest configuration has been set up to find `site.config` in a `test.site.config.tsx` file.
571
+
The Jest configuration has been set up to find `site.config` in a `site.config.test.tsx` file.
575
572
576
573
Once you've verified your test suite still works, you should delete the `.env.test` file.
577
574
578
-
A sample `test.site.config.tsx` file:
575
+
A sample `site.config.test.tsx` file:
579
576
580
577
```
581
-
import { ProjectSiteConfig } from '@openedx/frontend-base';
578
+
import { SiteConfig } from '@openedx/frontend-base';
@@ -629,12 +626,12 @@ Remove core-js and regenerator-runtime
629
626
We don't need these libraries anymore, remove them from the package.json dependencies and remove any imports of them in the code.
630
627
631
628
632
-
Create a project.scss file
633
-
==========================
629
+
Create a site.scss file
630
+
=======================
634
631
635
632
This is required if you intend to run builds from the app itself.
636
633
637
-
Create a new `project.scss` file at the top of your application. It's responsible for:
634
+
Create a new `site.scss` file at the top of your application. It's responsible for:
638
635
639
636
1. Importing the shell's stylesheet, which includes Paragon's core stylesheet.
640
637
2. Importing your brand stylesheet.
@@ -643,16 +640,16 @@ Create a new `project.scss` file at the top of your application. It's responsib
643
640
You must then import this new stylesheet into your `site.config` file:
644
641
645
642
```diff
646
-
+ import './project.scss';
643
+
+ import './site.scss';
647
644
648
-
const config: ProjectSiteConfig = {
645
+
const config: SiteConfig = {
649
646
// config document
650
647
}
651
648
652
649
export default config;
653
650
```
654
651
655
-
This file will be ignored via `.gitignore`, as it is part of your 'project', not the module library.
652
+
This file will be ignored via `.gitignore`, as it is part of your 'site', not the module library.
656
653
657
654
658
655
Document module-specific configuration needs
@@ -731,7 +728,7 @@ Refactor plugin-slots
731
728
732
729
First, rename `src/plugin-slots`, if it exists, to `src/slots`. Modify imports and documentation across the codebase accordingly.
733
730
734
-
Next, the frontend-base equivalent to `<PluginSlot />` is `<Slot />`, and has a different API. This includes a change in the slot ID, according to the [new slot naming ADR](../decisions/0009-slot-naming-and-lifecycle.rst) in this repository. Rename them accordingly. You can refer to the `src/shell/dev-project` in this repository for examples.
731
+
Next, the frontend-base equivalent to `<PluginSlot />` is `<Slot />`, and has a different API. This includes a change in the slot ID, according to the [new slot naming ADR](../decisions/0009-slot-naming-and-lifecycle.rst) in this repository. Rename them accordingly. You can refer to the `src/shell/dev-site` in this repository for examples.
"lint": "eslint .; npm run lint:tools; npm --prefix ./test-project run lint",
20
+
"lint": "eslint .; npm run lint:tools; npm --prefix ./test-site run lint",
21
21
"lint:tools": "cd ./tools && eslint . && cd ..",
22
22
"test": "jest",
23
-
"test-project": "npm --prefix ./test-project i; npm --prefix ./test-project run build",
24
-
"test-project:refresh": "npm run build && npm pack && cd test-project && npm i --audit=false --fund=false ../openedx-frontend-base-1.0.0.tgz && cd ../"
23
+
"test-site:build": "npm --prefix ./test-site i; npm --prefix ./test-site run build",
24
+
"test-site:refresh": "npm run build && npm pack && cd test-site && npm i --audit=false --fund=false ../openedx-frontend-base-1.0.0.tgz && cd ../"
0 commit comments