日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SAP Spartacus Reference App Structure

發布時間:2023/12/19 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP Spartacus Reference App Structure 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

https://sap.github.io/spartacus-docs/reference-app-structure/

該概念在 SAP Spartacus 3.1 版本引入。

這個 Reference App Structure 是 SAP 推薦客戶在搭建自己的 Spartacus Storefront 時所用的參考。

Spartacus 包含若干可以 lazy load 的 feature libraries.

Customizations and third-party code add further complexity, and you can end up with modules that are difficult to maintain because they mix too many of these elements together.

定制化和第三方代碼進一步增加了項目復雜度,如果處理不得當,很容易出現堆砌了大量 module,難于維護的情況。

This can be solved by defining and adhering to a standardized structure, such as the Spartacus reference app structure.

而遵循 Spartacus reference app structure 來開發,就能避免此類問題出現。

Having a standardized structure also makes it easier to onboard new developers to your project, to handle external support cases, and to take care of audits.

有一套標準的工程結構,也便于新開發人員進入項目后,快速熟悉項目并上手。

結構

1. AppModule

2. SpartacusModule

3.BaseStorefrontModule

從 @spartacus/storefront 里導入,再導出。

4.SpartacusFeatureModule

5. feature related modules

6. 配置 module

Every Angular application has a root app module, usually named AppModule. In the reference app strcuture, this module includes application-wide imports, and avoids complex module imports related to Spartacus by handling only one SpartacusModule.

每個 Angular 應用都有一個 root app module,通常命名為 AppModule. 在 SAP Spartacus reference app structure 里,AppModule 包含了應用層級的 imports:

Both Angular Router and NgRx are used by Spartacus, but these affect the global application, so they are kept outside of the SpartacusModule and are imported directly in the AppModule.

從上圖可見,StoreModule 和 EffectsModule 等 module,因為整個應用的其他定制開發很可能也會用到,因此直接在 AppModule 里 import,而沒有放到 SpartacusModule 里。

SpartacusModule 包含三部分:

  • The BaseStorefrontModule, which encapsulates core Spartacus imports that are usually required by most Spartacus applications.
  • 包含了任何 Spartacus 應用都必需的 imports.

    The BaseStorefrontModule is imported directly from @spartacus/storefront.

  • The SpartacusFeaturesModule, which encapsulates Spartacus features.
  • Spartacus feature 又分為兩部分:來自 @Spartacus/storefront 和 features 文件夾下的 modules.

  • The SpartacusConfigurationModule, which encapsulates the general Spartacus configuration.
  • 配置信息:

    Feature-specific configurations can be kept either in feature modules, or in the SpartacusConfigurationModule. Keeping them in feature modules helps to maintain a good separation of concerns, so it is generally recommended.

    feature 相關的配置信息,推薦放到 feature modules 里,從而遵循關注點分離的原則。

    更多Jerry的原創文章,盡在:“汪子熙”:

    總結

    以上是生活随笔為你收集整理的SAP Spartacus Reference App Structure的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。