criticalmanufacturing / cli

Critical Manufacturing Projects Command Line Tool
https://criticalmanufacturing.github.io/cli/
BSD 3-Clause "New" or "Revised" License
10 stars 22 forks source link

Support defining TargetPlatform when loading MasterData #368

Open lmponte opened 5 months ago

lmponte commented 5 months ago

When loading Master Data for apps, we need to have the ability to load some objects to the MES instance instead of the app. The Deployment Framework already supports this, with the following syntax:

<step type="MasterData" title="Master Data" .... targetPlatform="AppFramework" />

CLI should support generating Data packages with MasterData steps with this attribute.

lmponte commented 5 months ago

Should we add a new contentType for this to be used in the Data PackageType? Assuming I am understanding this right, it should not be required, we could add the new property to the Step, declare it explicitly on the package steps and use a generic package type. The cmfpackage.json would become something like this:

{
  "packageId": "Cmf.Apps.Data.MES",
  "version": "1.0.0",
  "description": "Master Data to be Loaded to MES",
+  "packageType": "Generic",
  "isInstallable": true,
  "isUniqueInstall": true,
  "steps": [
    {
      "order": "1",
      "type": "MasterData",
+      "targetPlatform": "AppFramework",
      "ContentPath": "**/**"
    }
  ],
  "contentToPack": [
    {
      "source": "$(version)/*",
      "target": "",
      "ignoreFiles": [
        "../.cmfpackageignore"
      ]
    }
  ]
}

But this would require all data that is loaded to MES to be handled in a separate package.

The other option is to also support this as part of the Data PackageType, in which case we would need a new contentType. The cmfpackage.json would be something like this:

{
  "packageId": "Cmf.Apps.Data",
  "version": "1.0.0",
  "description": "Data Package",
+  "packageType": "Data",
  "isInstallable": true,
  "isUniqueInstall": true,
  "contentToPack": [
    {
      "source": "$(version)/*",
      "target": "$(version)/",
+      "contentType": "AppFrameworkMasterData"
    }
  ]
}

If the contentType is AppFrameworkMasterData, the generated MasterData step would get the targetPlatform="AppFramework" attribute.