cloud-native-app-initializer icon indicating copy to clipboard operation
cloud-native-app-initializer copied to clipboard

Support writing code to different modules

Open weixsun opened this issue 3 years ago • 2 comments

CN: 当选择一个dependency时,能够支持按照模块后缀名分别写入不同模块中,下面是一个简单说明示例:

    - name: Web
      content:
        - name: Spring Web
          id: web
          description: xxx
          archCfg:
            mvc:
              modules:
                web:
                  code: true
                service:
                  code: true
                start:
                  code: false
./
├── web
│   ├── java
│   │   └── Xxx.java.mustache
│   └── resources
│       ├── application.properties.mustache
│       └── log4j.properties.mustache
├── service
│   └── java
│       └── Yyy.java.mustache
└── start
    ├── java
    │   ├── Zzz.java.mustache
    └── resources
        ├── application.properties.mustache
        └── log4j.properties.mustache

结果:选择Spring Web 依赖时,会向web 和 service模块写入相应代码,start 模块因为code: false而不写入模版目录下的start 代码。

weixsun avatar Dec 23 '22 15:12 weixsun

这个问题,我们目前的想法:是希望通过在组件依赖上增加对不同架构的适配来实现。 主要是担心一个问题,如果要为每个架构定制示例代码,那么架构的维护和示例代码的维护就产生交集,这样带来的维护工作量会比较大。 当然,这个做法有一个缺点:无法支持一个组件的示例代码需要分布在不同的模块中。

theonefx avatar Dec 26 '22 07:12 theonefx

嗯,我理解你的担忧,并且我上面的说明示例和正在 #27 上的工作也许不是最终通用的,因为我忽略了架构纬度,我正好在此处进行正确的、我理想中的描述,以供其他人正确参考:

└── web
    ├── mvc
    │   ├── service
    │   │   ├── java
    │   │   │   └── Yyy.java.mustache
    │   │   └── resources
    │   ├── start
    │   │   ├── java
    │   │   │   └── Zzz.java.mustache
    │   │   └── resources
    │   │       ├── application.properties.mustache
    │   │       └── log4j.properties.mustache
    │   └── web
    │       ├── java
    │       │   └── Xxx.java.mustache
    │       └── resources
    │           ├── application.properties.mustache
    │           └── log4j.properties.mustache
    └── other

weixsun avatar Dec 26 '22 08:12 weixsun