@edx/frontend-platform 1.12.7 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -77,6 +77,21 @@ initialize({
|
|
|
77
77
|
});
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
When using runtime configuration via `mergeConfig` noted above, `getConfig` must be called within a component's render lifecycle in order 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:
|
|
81
|
+
|
|
82
|
+
```jsx
|
|
83
|
+
import { getConfig } from '@edx/frontend-platform/config';
|
|
84
|
+
|
|
85
|
+
// The runtime configuration `CUSTOM_VARIABLE` added in the above code snippet will not appear here. This is
|
|
86
|
+
// because `getConfig` is called before `mergeConfig` is executed to add the custom runtime configuration.
|
|
87
|
+
console.log(getConfig().CUSTOM_VARIABLE); // returns undefined
|
|
88
|
+
|
|
89
|
+
const ExampleComponent = () => {
|
|
90
|
+
// This returns the value as expected since it is called after `mergeConfig` has already executed.
|
|
91
|
+
console.log(getConfig().CUSTOM_VARIABLE)
|
|
92
|
+
};
|
|
93
|
+
```
|
|
94
|
+
|
|
80
95
|
### Service interfaces
|
|
81
96
|
|
|
82
97
|
Each service (analytics, auth, i18n, logging) provided by frontend-platform has a API contract which all implementations of that service are guaranteed to fulfill. Applications that use frontend-platform can use its configured services via a convenient set of exported functions. An application that wants to use the service interfaces need only initialize them via the initialize() function, optionally providing custom service interfaces as desired (you probably won't need to).
|
|
@@ -58,7 +58,7 @@ if (process.argv[3] === '--comments') {
|
|
|
58
58
|
// prepare to handle the translator notes
|
|
59
59
|
var loggingPrefix = path.basename("".concat(__filename)); // the name of this JS file
|
|
60
60
|
|
|
61
|
-
var bashScriptsPath = './node_modules/reactifex/bash_scripts';
|
|
61
|
+
var bashScriptsPath = process.argv[4] && process.argv[4] === '--v3-scripts-path' ? './node_modules/@edx/reactifex/bash_scripts' : './node_modules/reactifex/bash_scripts';
|
|
62
62
|
var hashFile = "".concat(bashScriptsPath, "/hashmap.json");
|
|
63
63
|
process.stdout.write("".concat(loggingPrefix, ": reading hash file ").concat(hashFile, "\n"));
|
|
64
64
|
var messageInfo = JSON.parse(fs.readFileSync(hashFile));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/i18n/scripts/transifex-utils.js"],"names":["fs","require","glob","path","gatherJson","dir","ret","files","sync","forEach","filename","messages","JSON","parse","readFileSync","push","escapeDots","messageId","replace","jsonDir","process","argv","messageObjects","length","exitCode","Error","loggingPrefix","basename","__filename","bashScriptsPath","hashFile","stdout","write","messageInfo","outputFile","writeFileSync","message","transifexFormatId","id","info","find","mi","key","appendFileSync","string_hash","description","output","defaultMessage","stringify"],"mappings":"AAAA;;;;;;;;;;;;;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAD,CAAlB;;AACA,IAAMC,IAAI,GAAGD,OAAO,CAAC,MAAD,CAApB;;AACA,IAAME,IAAI,GAAGF,OAAO,CAAC,MAAD,CAApB;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASG,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAMC,GAAG,GAAG,EAAZ;AACA,MAAMC,KAAK,GAAGL,IAAI,CAACM,IAAL,WAAaH,GAAb,gBAAd;AAEAE,EAAAA,KAAK,CAACE,OAAN,CAAc,UAACC,QAAD,EAAc;AAC1B,QAAMC,QAAQ,GAAGC,IAAI,CAACC,KAAL,CAAWb,EAAE,CAACc,YAAH,CAAgBJ,QAAhB,CAAX,CAAjB;AACAJ,IAAAA,GAAG,CAACS,IAAJ,OAAAT,GAAG,qBAASK,QAAT,EAAH;AACD,GAHD;AAIA,SAAOL,GAAP;AACD,C,CAED;AACA;AACA;;;AACA,SAASU,UAAT,CAAoBC,SAApB,EAA+B;AAC7B,SAAOA,SAAS,CAACC,OAAV,CAAkB,KAAlB,EAAyB,KAAzB,CAAP;AACD;;AAED,IAAMC,OAAO,GAAGC,OAAO,CAACC,IAAR,CAAa,CAAb,CAAhB;AACA,IAAMC,cAAc,GAAGlB,UAAU,CAACe,OAAD,CAAjC;;AAEA,IAAIG,cAAc,CAACC,MAAf,KAA0B,CAA9B,EAAiC;AAC/BH,EAAAA,OAAO,CAACI,QAAR,GAAmB,CAAnB;AACA,QAAM,IAAIC,KAAJ,CAAU,mBAAV,CAAN;AACD;;AAED,IAAIL,OAAO,CAACC,IAAR,CAAa,CAAb,MAAoB,YAAxB,EAAsC;AAAE;AACtC,MAAMK,aAAa,GAAGvB,IAAI,CAACwB,QAAL,WAAiBC,UAAjB,EAAtB,CADoC,CACkB;;AACtD,MAAMC,eAAe,
|
|
1
|
+
{"version":3,"sources":["../../../src/i18n/scripts/transifex-utils.js"],"names":["fs","require","glob","path","gatherJson","dir","ret","files","sync","forEach","filename","messages","JSON","parse","readFileSync","push","escapeDots","messageId","replace","jsonDir","process","argv","messageObjects","length","exitCode","Error","loggingPrefix","basename","__filename","bashScriptsPath","hashFile","stdout","write","messageInfo","outputFile","writeFileSync","message","transifexFormatId","id","info","find","mi","key","appendFileSync","string_hash","description","output","defaultMessage","stringify"],"mappings":"AAAA;;;;;;;;;;;;;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAD,CAAlB;;AACA,IAAMC,IAAI,GAAGD,OAAO,CAAC,MAAD,CAApB;;AACA,IAAME,IAAI,GAAGF,OAAO,CAAC,MAAD,CAApB;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASG,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAMC,GAAG,GAAG,EAAZ;AACA,MAAMC,KAAK,GAAGL,IAAI,CAACM,IAAL,WAAaH,GAAb,gBAAd;AAEAE,EAAAA,KAAK,CAACE,OAAN,CAAc,UAACC,QAAD,EAAc;AAC1B,QAAMC,QAAQ,GAAGC,IAAI,CAACC,KAAL,CAAWb,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B;AAEAZ,EAAAA,cAAc,CAACb,OAAf,CAAuB,UAAC2B,OAAD,EAAa;AAClC,QAAMC,iBAAiB,GAAGrB,UAAU,CAACoB,OAAO,CAACE,EAAT,CAApC;AAEA,QAAMC,IAAI,GAAGN,WAAW,CAACO,IAAZ,CAAiB,UAAAC,EAAE;AAAA,aAAIA,EAAE,CAACC,GAAH,KAAWL,iBAAf;AAAA,KAAnB,CAAb;;AACA,QAAIE,IAAJ,EAAU;AACRvC,MAAAA,EAAE,CAAC2C,cAAH,CAAkBT,UAAlB,YAAiCK,IAAI,CAACK,WAAtC,cAAqDR,OAAO,CAACS,WAA7D;AACD,KAFD,MAEO;AACLzB,MAAAA,OAAO,CAACW,MAAR,CAAeC,KAAf,WAAwBN,aAAxB,sBAAiDU,OAAO,CAACE,EAAzD;AACD;AACF,GATD;AAUD,CAzBD,MAyBO;AACL,MAAMQ,MAAM,GAAG,EAAf;AAEAxB,EAAAA,cAAc,CAACb,OAAf,CAAuB,UAAC2B,OAAD,EAAa;AAClCU,IAAAA,MAAM,CAACV,OAAO,CAACE,EAAT,CAAN,GAAqBF,OAAO,CAACW,cAA7B;AACD,GAFD;AAGA/C,EAAAA,EAAE,CAACmC,aAAH,CAAiBf,OAAO,CAACC,IAAR,CAAa,CAAb,CAAjB,EAAkCT,IAAI,CAACoC,SAAL,CAAeF,MAAf,EAAuB,IAAvB,EAA6B,CAA7B,CAAlC;AACD","sourcesContent":["#!/usr/bin/env node\n\nconst fs = require('fs');\nconst glob = require('glob');\nconst path = require('path');\n\n/*\n * See the Makefile for how the required hash file is downloaded from Transifex.\n */\n\n/*\n * Expected input: a directory, possibly containing subdirectories, with .json files. Each .json\n * file is an array of translation triplets (id, description, defaultMessage).\n *\n *\n */\nfunction gatherJson(dir) {\n const ret = [];\n const files = glob.sync(`${dir}/**/*.json`);\n\n files.forEach((filename) => {\n const messages = JSON.parse(fs.readFileSync(filename));\n ret.push(...messages);\n });\n return ret;\n}\n\n// the hash file returns ids whose periods are \"escaped\" (sort of), like this:\n// \"key\": \"profile\\\\.sociallinks\\\\.social\\\\.links\"\n// so our regular messageIds won't match them out of the box\nfunction escapeDots(messageId) {\n return messageId.replace(/\\./g, '\\\\.');\n}\n\nconst jsonDir = process.argv[2];\nconst messageObjects = gatherJson(jsonDir);\n\nif (messageObjects.length === 0) {\n process.exitCode = 1;\n throw new Error('Found no messages');\n}\n\nif (process.argv[3] === '--comments') { // prepare to handle the translator notes\n const loggingPrefix = path.basename(`${__filename}`); // the name of this JS file\n const bashScriptsPath = (\n process.argv[4] && process.argv[4] === '--v3-scripts-path'\n ? './node_modules/@edx/reactifex/bash_scripts'\n : './node_modules/reactifex/bash_scripts');\n\n const hashFile = `${bashScriptsPath}/hashmap.json`;\n process.stdout.write(`${loggingPrefix}: reading hash file ${hashFile}\\n`);\n const messageInfo = JSON.parse(fs.readFileSync(hashFile));\n\n const outputFile = `${bashScriptsPath}/hashed_data.txt`;\n process.stdout.write(`${loggingPrefix}: writing to output file ${outputFile}\\n`);\n fs.writeFileSync(outputFile, '');\n\n messageObjects.forEach((message) => {\n const transifexFormatId = escapeDots(message.id);\n\n const info = messageInfo.find(mi => mi.key === transifexFormatId);\n if (info) {\n fs.appendFileSync(outputFile, `${info.string_hash}|${message.description}\\n`);\n } else {\n process.stdout.write(`${loggingPrefix}: string ${message.id} does not yet exist on transifex!\\n`);\n }\n });\n} else {\n const output = {};\n\n messageObjects.forEach((message) => {\n output[message.id] = message.defaultMessage;\n });\n fs.writeFileSync(process.argv[3], JSON.stringify(output, null, 2));\n}\n"],"file":"transifex-utils.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Foundational application framework for Open edX micro-frontend applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,19 +31,17 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/edx/frontend-platform#readme",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@commitlint/cli": "13.1.0",
|
|
35
|
-
"@commitlint/config-angular": "13.1.0",
|
|
36
34
|
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
|
37
|
-
"@edx/frontend-build": "8.0.
|
|
38
|
-
"@edx/paragon": "16.
|
|
35
|
+
"@edx/frontend-build": "8.0.6",
|
|
36
|
+
"@edx/paragon": "16.15.1",
|
|
39
37
|
"axios-mock-adapter": "1.20.0",
|
|
40
38
|
"codecov": "3.8.3",
|
|
41
|
-
"core-js": "3.
|
|
39
|
+
"core-js": "3.18.3",
|
|
42
40
|
"enzyme": "3.11.0",
|
|
43
41
|
"enzyme-adapter-react-16": "1.15.6",
|
|
44
|
-
"husky": "7.0.
|
|
42
|
+
"husky": "7.0.4",
|
|
45
43
|
"jsdoc": "3.6.7",
|
|
46
|
-
"nodemon": "2.0.
|
|
44
|
+
"nodemon": "2.0.13",
|
|
47
45
|
"prop-types": "15.7.2",
|
|
48
46
|
"react": "16.14.0",
|
|
49
47
|
"react-dom": "16.14.0",
|