UNPKG

@paroicms/site-generator-plugin

Version:

ParoiCMS Site Generator Plugin

123 lines (92 loc) 3.2 kB
You are tasked with modifying a JSON object based on a given TypeScript type definition and an update message. Follow these steps carefully: # 1. Review the TypeScript type definition of the JSON structure: <site_schema_ts_defs> {{siteSchemaTsDefs}} </site_schema_ts_defs> # 2. Fields In a list of fields, an item can be either a predefined field name (a string) or a custom field type, which is an object of type `JtFieldType`. Here are the predefined fields provided by ParoiCMS: <predefined_fields_json> {{predefinedFields}} </predefined_fields_json> Here is an example of an object for describing a custom **HTML** field type: <field_type_example> { "name": "myCustomField", "localized": true, "storedAs": "text", "dataType": "json", "renderAs": "html", "useAsExcerpt": 1, "plugin": "@paroicms/quill-editor-plugin" } </field_type_example> Then, in the locales, the translations of custom field types must be in a sub-key `fields` of the node type: <l10n_example> { "nodeTypes": { ... "myNodeTypeName": { ... "fields": { "myCustomField": { "label": "My custom field", "description": "This is a description that will be displayed in a tooltip of the admin-ui" } } } } } </l10n_example> Here is how to write field locales for a custom site field: <l10n_example> { "nodeTypes": { ... "_site": { "fields": { "myCustomSiteField": { "label": "My custom site field", "description": "…" } } } } } </l10n_example> Important: - Never add locales for a predefined field. - Never add an unknown predefined field. - The type name of the "site" node type is omitted from the JSON but its value is always `_site`. # 3. Labeling fields (using a taxonomy) A labeling field lets the user assign taxonomy terms to a document (or part). <field_type_example> { "name": "tags", "localized": false, "storedAs": "labeling", "taxonomy": "tags", "multiple": true }, </field_type_example> Most of the time, the field name will be the same as the taxonomy type name. # 4. Examine the current JSON data, which conforms to the `JtSiteSchema` type: <site_schema_json> {{siteSchemaJson}} </site_schema_json> Also, the attached locales: <l10n_json> {{l10nJson}} </l10n_json> # 5. Now, here is what to do: <user_request> {{taskDetailsMd}} </user_request> # 6. Guidelines - Don't assume how the CMS works. If you are not sure how to do something, don't do it. - You are allowed to be proactive, but only when the user asks you to do something. - Remember to adhere strictly to the TypeScript typing when making changes. If the update message requests changes that would violate the typing, then prioritize maintaining the correct structure over making those specific changes. # 7. Output If there is a change in the site schema, then provide the updated site schema in JSON within <updated_site_schema_json> tags. Otherwise, let this tag empty. If there is a change in the locales, then provide the updated attached locales within <updated_l10n_json>. Otherwise, let this tag empty. Do not write any explanation or commentary outside these tags.