typewriter icon indicating copy to clipboard operation
typewriter copied to clipboard

Allow variables in typewriter.yml file, for instance to specify output dir

Open tmf-chris opened this issue 2 years ago • 1 comments

Typewriter requires a typewriter.yml file to be present when running a tracking plans update. However, this is static and I would like to be able to use variables in the yml file (for instance to be able to specify folders in which my output should be placed as well as customize some scripts->after behaviours).

Feature request:

  1. Allow passing of variables to the typewriter command, that are then available when the typewriter.yml file is being parsed or
  2. Allow piping in a typewriter.yml into the typewriter command (so no typewriter.yml file needed on disk necessarily) - in this way I can inject variables with values myself before running typewriter.

A workaround (I think) is in the scripts->after section I can move files from a local output dir into the output dir of my choice.

Example:

I have a variable called DEST which is my output dir. I would like to supply this when parsing the typewriter file somehow:

scripts:
  after: prettier --write {{DEST}}

client:
  ...

trackingPlans:
  - id: ...
    path: {{DEST}}/plan1
  - id: ...
    path: {{DEST}}/plan2

Thank you team for an awesome tool!

tmf-chris avatar Feb 28 '23 19:02 tmf-chris

It might make more sense to allow typewriter to use a js or ts file as config. You could also generate the yaml file dynamically on your end (as a stop gap.)

silesky avatar Apr 26 '23 00:04 silesky