@xleddyl/nuxt-cms 0.4.1 → 0.4.2
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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1017,12 +1017,8 @@ function blockTypesTs(entryName, key, field) {
|
|
|
1017
1017
|
members.push(name);
|
|
1018
1018
|
const lines = [];
|
|
1019
1019
|
for (const [blockFieldKey, blockField] of Object.entries(block.fields)) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
continue;
|
|
1023
|
-
}
|
|
1024
|
-
const base = scalarTsType(blockField);
|
|
1025
|
-
lines.push(` ${blockFieldKey}: ${blockField.required ? base : `${base} | null`}`);
|
|
1020
|
+
const base = blockField.type === "media" ? mediaTsType(blockField) : scalarTsType(blockField);
|
|
1021
|
+
lines.push(` ${blockFieldKey}: ${base} | null`);
|
|
1026
1022
|
}
|
|
1027
1023
|
defs.push(`export interface ${props} {
|
|
1028
1024
|
${lines.join("\n")}
|
|
@@ -80,8 +80,7 @@ ${lines.join("\n")}
|
|
|
80
80
|
}`;
|
|
81
81
|
}
|
|
82
82
|
function blockFieldSdl(field) {
|
|
83
|
-
|
|
84
|
-
return { base: scalarFor(field), nonNull: !!field.required };
|
|
83
|
+
return field.type === "media" ? "CmsMedia" : scalarFor(field);
|
|
85
84
|
}
|
|
86
85
|
function sharedBlockFieldsSdl(field) {
|
|
87
86
|
const blocks = Object.values(field.blocks ?? {});
|
|
@@ -92,9 +91,8 @@ function sharedBlockFieldsSdl(field) {
|
|
|
92
91
|
const rendered = blocks.map((block) => block.fields[key]);
|
|
93
92
|
if (rendered.some((blockField) => !blockField)) continue;
|
|
94
93
|
const types = rendered.map((blockField) => blockFieldSdl(blockField));
|
|
95
|
-
if (types.some((type) => type
|
|
96
|
-
|
|
97
|
-
lines.push(` ${key}: ${types[0].base}${nonNull ? "!" : ""}`);
|
|
94
|
+
if (types.some((type) => type !== types[0])) continue;
|
|
95
|
+
lines.push(` ${key}: ${types[0]}`);
|
|
98
96
|
}
|
|
99
97
|
return lines;
|
|
100
98
|
}
|
|
@@ -109,8 +107,7 @@ ${shared.join("\n")}
|
|
|
109
107
|
for (const [blockName, block] of blocks) {
|
|
110
108
|
const lines = [" type: String!"];
|
|
111
109
|
for (const [blockFieldKey, blockField] of Object.entries(block.fields)) {
|
|
112
|
-
|
|
113
|
-
lines.push(` ${blockFieldKey}: ${type.base}${type.nonNull ? "!" : ""}`);
|
|
110
|
+
lines.push(` ${blockFieldKey}: ${blockFieldSdl(blockField)}`);
|
|
114
111
|
}
|
|
115
112
|
const gqlType = blockTypeName(name, key, blockName);
|
|
116
113
|
defs.push(`type ${gqlType} implements ${interfaceName} {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xleddyl/nuxt-cms",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Lightweight CMS that ships with your Nuxt app: runs on the Nitro server, content types defined in code, /cms admin panel, GraphQL API, SQLite or Postgres. No external CMS needed!",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Edoardo Alberti (https://github.com/xleddyl)",
|