Skip to content

Commit 0a849f5

Browse files
wgu-taylor-paynearbrandes
authored andcommitted
docs: update outdated info, reword, reformat
1 parent 2b5a8c5 commit 0a849f5

File tree

5 files changed

+22
-29
lines changed

5 files changed

+22
-29
lines changed

README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,16 @@ In addition, frontend-platform provides an extensible application initialization
2626
## Getting started
2727

2828
### One-time setup if you have not upgraded node/npm
29-
IMPORTANT: There is now a new node/npm version being used by frontend-platform as of
30-
https://github.com/openedx/frontend-platform/pull/259
3129

3230
#### Install nvm
33-
This is highly recommended to be able to leverage different node/npm versions.
34-
For a some time, different repositories may be using different versions of node/npm.
35-
36-
Alternatively, please install node16 and npm8 for use with this repository.
31+
This is highly recommended to be able to leverage different node/npm versions. For some time, different repositories may be using different versions of node/npm.
3732

3833
#### Switch to node/npm version for this repo
39-
```nvm use```
40-
if you don't have the right node/npm versions, nvm will instruct you to install those
34+
In the project’s root directory, run `nvm use` to set your environment to the correct node version. If the required node or npm versions are not installed, nvm will prompt you to install them.
4135

4236
#### Clean out old node modules and reinstall
4337
This step is needed because node now uses a different package lock format, and it's important to reinstall
44-
dependencies based on this new package file. Delete node_modules, and issue an `npm ci`
45-
38+
dependencies based on this new package file. Delete `node_modules`, and run `npm ci`.
4639

4740
### Standard getting started steps
4841

@@ -98,7 +91,7 @@ initialize({
9891
});
9992
```
10093

101-
When using runtime configuration via `mergeConfig` noted above, `getConfig` must be called within a component's render lifecycle for the added keys and values to be returned in the configuration object. If `getConfig` is called outside of a component's render lifecycle, the custom configuration key/value pairs will not initially be part of the object returned by `getConfig`. For example:
94+
When using runtime configuration via `mergeConfig` as noted above, `getConfig` must be called within a component's render lifecycle for the added keys and values to be returned in the configuration object. If `getConfig` is called outside of a component's render lifecycle, the custom configuration key/value pairs will not initially be part of the object returned by `getConfig`. For example:
10295

10396
```jsx
10497
import { getConfig } from '@edx/frontend-platform/config';
@@ -130,7 +123,7 @@ The included service implementations are:
130123
- Axios/JWT (auth)
131124
- React Intl (i18n)
132125

133-
NOTE: As of this writing, i18n is _not_ configurable. The `initialize()` function does not allow applications to supply an alternate i18n implementation; this is because the interface and implementation for i18n has not yet been separated and modularized.
126+
NOTE: As of this writing, i18n is _not_ configurable. The `initialize()` function does not allow applications to supply an alternative i18n implementation; this is because the interface and implementation for i18n has not yet been separated and modularized.
134127

135128
# Local Development & Testing Locally
136129

docs/decisions/0007-javascript-file-configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Anecdotally, in the past frontend-build used JSON versions of many of
135135
its configuration files (Babel, eslint, jest) but over time they were all
136136
converted to JavaScript files so we could express more complicated
137137
configuration needs. Since one of the primary use cases and reasons we need a
138-
new configuration method is to allow developers to supply alternate
138+
new configuration method is to allow developers to supply alternative
139139
implementations of frontend-platform's core services (analytics, logging), JSON
140140
was effectively a non-starter.
141141

src/config.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
*
4141
* ###### JavaScript File Configuration
4242
*
43-
* Configuration variables can be supplied in an optional file named env.config.js. This file must
44-
* export either an Object containing configuration variables or a function. The function must
45-
* return an Object containing configuration variables or, alternately, a promise which resolves to
46-
* an Object.
43+
* Configuration variables can be supplied in an optional file named env.config.js (it can also be
44+
* a `.jsx`, `.ts`, or `.tsx` file). This file must export either an Object containing configuration
45+
* variables or a function. The function must return an Object containing configuration variables or,
46+
* alternatively, a promise which resolves to an Object.
4747
*
4848
* Using a function or async function allows the configuration to be resolved at runtime (because
4949
* the function will be executed at runtime). This is not common, and the capability is included
@@ -89,11 +89,9 @@
8989
*
9090
* Configuration variables can also be supplied using the "runtime configuration" method, taking
9191
* advantage of the Micro-frontend Config API in edx-platform. More information on this API can be
92-
* found in the ADR which introduced it:
92+
* found in [the ADR which introduced it][1].
9393
*
94-
* https://github.com/openedx/edx-platform/blob/master/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst
95-
*
96-
* The runtime configuration method can be enabled by supplying a MFE_CONFIG_API_URL via one of the other
94+
* The runtime configuration method can be enabled by supplying a `MFE_CONFIG_API_URL` via one of the other
9795
* two configuration methods above.
9896
*
9997
* Runtime configuration is particularly useful if you need to supply different configurations to
@@ -103,9 +101,9 @@
103101
*
104102
* ##### Initialization Config Handler
105103
*
106-
* The configuration document can be extended by
107-
* applications at run-time using a `config` initialization handler. Please see the Initialization
108-
* documentation for more information on handlers and initialization phases.
104+
* The configuration document can be extended by applications at run-time using a `config`
105+
* initialization handler. Please see the Initialization documentation for more information on
106+
* handlers and initialization phases.
109107
*
110108
* ```
111109
* initialize({
@@ -114,13 +112,15 @@
114112
* mergeConfig({
115113
* CUSTOM_VARIABLE: 'custom value',
116114
* LMS_BASE_URL: 'http://localhost:18001' // You can override variables, but this is uncommon.
117-
* }, 'App config override handler');
115+
* }, 'App config override handler');
118116
* },
119117
* },
120118
* });
121119
* ```
122120
*
123121
* @module Config
122+
*
123+
* [1]: https://github.com/openedx/edx-platform/blob/master/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst
124124
*/
125125

126126
import { APP_CONFIG_INITIALIZED, CONFIG_CHANGED } from './constants';
@@ -223,7 +223,7 @@ let config = {
223223
* ```
224224
*
225225
* @returns {ConfigDocument}
226-
*/
226+
*/
227227
export function getConfig() {
228228
return config;
229229
}
@@ -313,7 +313,7 @@ export function ensureConfig(keys, requester = 'unspecified application code') {
313313
* In its most basic form, the initialization process loads this document via `process.env`
314314
* variables. There are other ways to add configuration variables to the ConfigDocument as
315315
* documented above (JavaScript File Configuration, Runtime Configuration, and the Initialization
316-
* Config Handler)
316+
* Config Handler).
317317
*
318318
* ```
319319
* {

src/initialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export async function initialize({
314314

315315
// This allows us to replace the implementations of the logging, analytics, and auth services
316316
// based on keys in the ConfigDocument. The JavaScript File Configuration method is the only
317-
// one capable of supplying an alternate implementation since it can import other modules.
317+
// one capable of supplying an alternative implementation since it can import other modules.
318318
// If a service wasn't supplied we fall back to the default parameters on the initialize
319319
// function signature.
320320
const loggingServiceImpl = getConfig().loggingService || loggingService;

src/react/hooks/paragon/useParagonTheme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const getDefaultThemeVariant = ({ themeVariants, themeVariantDefaults = {
8484
* A custom React hook that manages the application's theme state and injects the appropriate CSS for the theme core
8585
* and theme variants (e.g., light and dark modes) into the HTML document. It handles dynamically loading the theme
8686
* CSS based on the current theme variant, and ensures that the theme variant's CSS is preloaded for runtime theme
87-
* switching.This is done using "alternate" stylesheets. That is, the browser will download the CSS for the
87+
* switching. This is done using "alternate" stylesheets. That is, the browser will download the CSS for the
8888
* non-current theme variants with a lower priority than the current one.
8989
*
9090
* The hook also responds to system theme preference changes (e.g., via the `prefers-color-scheme` media query),

0 commit comments

Comments
 (0)