@contentstorage/core 0.4.0 → 0.4.1
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.
|
@@ -5,6 +5,8 @@ export declare let appConfig: Pick<AppConfig, 'contentKey' | 'languageCodes'> |
|
|
|
5
5
|
* Loads and sets the content for a specific language.
|
|
6
6
|
* It will internally ensure the application configuration (for contentDir) is loaded.
|
|
7
7
|
* @param contentJson
|
|
8
|
+
* Language code which is used for live editor to manage pending changes
|
|
9
|
+
* @param languageCode
|
|
8
10
|
*/
|
|
9
11
|
export declare function setContentLanguage({ languageCode, contentJson, }: {
|
|
10
12
|
languageCode: LanguageCode;
|
|
@@ -10,6 +10,8 @@ window.currentLanguageCode = null;
|
|
|
10
10
|
* Loads and sets the content for a specific language.
|
|
11
11
|
* It will internally ensure the application configuration (for contentDir) is loaded.
|
|
12
12
|
* @param contentJson
|
|
13
|
+
* Language code which is used for live editor to manage pending changes
|
|
14
|
+
* @param languageCode
|
|
13
15
|
*/
|
|
14
16
|
export function setContentLanguage({ languageCode, contentJson, }) {
|
|
15
17
|
if (!contentJson || typeof contentJson !== 'object') {
|
|
@@ -24,7 +24,10 @@ export async function fetchContent(language) {
|
|
|
24
24
|
throw new Error(`Expected a single JSON object from ${fileUrl} for language ${languageToFetch}, but received type ${typeof jsonData}. Cannot proceed.`);
|
|
25
25
|
}
|
|
26
26
|
console.log(`Received JSON for ${languageToFetch}`);
|
|
27
|
-
setContentLanguage(
|
|
27
|
+
setContentLanguage({
|
|
28
|
+
languageCode: languageToFetch,
|
|
29
|
+
contentJson: jsonData,
|
|
30
|
+
});
|
|
28
31
|
}
|
|
29
32
|
catch (error) {
|
|
30
33
|
// Catch errors related to fetching or saving a single language file
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@contentstorage/core",
|
|
3
3
|
"author": "Kaido Hussar <kaidohus@gmail.com>",
|
|
4
4
|
"homepage": "https://contentstorage.app",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Fetch content from contentstorage and generate TypeScript types",
|
|
8
8
|
"module": "dist/index.js",
|