RobinCK / typeorm-fixtures

:pill: Fixtures loader for typeorm 🇺🇦
https://robinck.github.io/typeorm-fixtures/
MIT License
566 stars 45 forks source link

Literal double curly braces not possible due to faker parser #117

Closed matomesc closed 4 years ago

matomesc commented 4 years ago

Due to https://github.com/RobinCK/typeorm-fixtures/blob/master/src/parsers/FakerParser.ts#L15 it's impossible to have a string with literal double curly, for example:

entity: User
items:
  user0:
    comment: 'here is a liquid template {{ my_variable }}'

will fail to build with a Invalid module: my_variable exception thrown by faker.

RobinCK commented 4 years ago

you can try using postprocessor to cast the string to your format

entity: User
items:
  user0:
    comment: 'here is a liquid template [[ my_variable ]]'

and in postprocessor replaced to {{ ... }}

matomesc commented 4 years ago

Great that works, thanks for the help.