You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to effectively work with the seancorfield/deps-new programmatic transformation
I assume the simplest way is to have different files used as the source where code should be different based on a give option.
It seems a more involved approach to rewrite template files, although depending on the changes this may make a simpler template to maintain
One thing that is not so clear from the docs is the difference between data and edn - although I added a println function to show the respective values in each when running the template (I am assuming data is keys from the template and edn is the template plus the project basis, maybe some other bits)
data-fn
updating keys in the overall template.edn file seems pretty straight forward via the data-fn
Very basic example that creates another key/value based on the value of an existing value in the template
(defndata-fn"Transform key/value pairs in the template Return: hash-map to be merged into the data by deps-new"
[data]
;; returning nil means no changes to options data
(when (= (data:component) "integrant")
{:integrant-repltrue})
)
transform-fn
Effective ways to transform the :transform [[,,,]] data based on the template.edn key/values
Are there helpers that simplify transforming the [[ ,,, ]] structure
Created a src/practicalli/rules.clj file to define declarative rule sets that will be returned instead of the default :transform data structure in the template.edn file for a specific template.
The template-edn function uses the substitution data to decide which rule set to return
How to effectively work with the seancorfield/deps-new programmatic transformation
I assume the simplest way is to have different files used as the source where code should be different based on a give option.
It seems a more involved approach to rewrite template files, although depending on the changes this may make a simpler template to maintain
data-fn
updating keys in the overall template.edn file seems pretty straight forward via the data-fn
Very basic example that creates another key/value based on the value of an existing value in the template
transform-fn
Effective ways to transform the
:transform [[,,,]]
data based on thetemplate.edn
key/valuesAre there helpers that simplify transforming the
[[ ,,, ]]
structureLibraries to review
References:
https://clojurians.slack.com/archives/C019ZQSPYG6/p1681126973615799
#21
The text was updated successfully, but these errors were encountered: