ecomplus / cloud-commerce

Complete platform on top of headless commerce APIs. High performant Astro + Vue storefront with built-in CMS. Integrations for payments, shipping, ERPs, CRMs and others. Truly extensible event-driven and serverless architecture. Easy and cheap deploy to Firebase.
https://demo.ecomplus.app/
MIT License
42 stars 6 forks source link

Globally overwrite default CMS content types #149

Closed leomp12 closed 1 year ago

leomp12 commented 1 year ago

Each store may be able to overwrite types from https://github.com/ecomplus/cloud-commerce/blob/main/packages/storefront/src/lib/cms.d.ts with something like:

declare module 'storefront' {
  export interface CmsSettings ...
}

Probably reading self content JSON files. It's specially useful for metafields (settings.metafields). At least for metafields, it should also be included default at the Store template source.

leomp12 commented 1 year ago

https://docs.astro.build/en/guides/content-collections/ auto generated types (./astro/types.d.ts) ? 🤔

leomp12 commented 1 year ago

Related to https://github.com/ecomplus/cloud-commerce/pull/136 (https://github.com/ecomplus/cloud-commerce/pull/136/commits/130d5a822d15e7c1e8d06ed5302e2a298495be62)

leomp12 commented 1 year ago

Na real já tá funcionando, só faltava um Exclude<keyof _SettingsContent, 'metafields'> em

export type SettingsContent = _SettingsContent &
  Omit<typeof import('content/settings.json'), Exclude<keyof _SettingsContent, 'metafields'>>;

🙃

E Astro content collections só funciona do MD(x) , JSON dá um warning...