criticalmanufacturing / cli

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

CLI does not generate a reliable config.json if Transform blocks that require merges are in the manifest #210

Closed m-s- closed 5 months ago

m-s- commented 2 years ago

If in a Presentation cmfpackage.json we have a transform block that performs an array merge or remove, this block will override the default merge/remove blocks at https://github.com/criticalmanufacturing/cli/blob/45b007a74b58b03b9bcec45bc1c76a8e8e257fb6/cmf-cli/resources/templateFiles/HTML/config.json#L2 as JDT will only apply the last matching merge/remove block in the file.

A workaround is to specify all merges/removes in the last transform block, but this can be difficult to orchestrate if we are using multiple presentation packages. Also, because the package token replacement happens at https://github.com/criticalmanufacturing/cli/blob/45b007a74b58b03b9bcec45bc1c76a8e8e257fb6/cmf-cli/Handlers/PackageType/PresentationPackageTypeHandler.cs#L103 and JDT injection only happens at https://github.com/criticalmanufacturing/cli/blob/45b007a74b58b03b9bcec45bc1c76a8e8e257fb6/cmf-cli/Handlers/PackageType/PresentationPackageTypeHandler.cs#L111 we cannot use the CLI tokens in the transform blocks, which means the package list must be hardcoded in the cmfpackage.json file, which is a maintenance burden.

Instead of just injecting, CLI should analyze the JDT transform paths and merge them in the correct keys. This will likely require that more tokens are available or that the file is built via a JSON Object, which is less flexible for templating.

m-s- commented 5 months ago

We're not implementing this in the foreseeable future as this transform approach is deprecated in favor of templating the config.json file for v10 forward.

I'm closing this issue as this is a known quantity and use will be residual.