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
As in #178 , #188 , #353 , the append action has a major problem when using regexp special characters in the template and when unique is set to true (or undefined since true is the default value).
Since the stringToAppend variable is the rendered template without further manipulation, if the template contains some regexp special characters, the regexp might be invalid.
when executed it gives the following error: Range out of order in character class. (since t-l is an invalid character range). This can be fixed by using for example: template: '"list": \\[ "element-list" ];',, but then the json generated is invalid (it prints literally "list": \[ "element-list" ]), so adding escape characters is not an option.
There was a PR fixing this: #330 but it was closed without merging.
If this happens to you, a temporary solution might be to explicitly set unique: false in your action configuration. But this is not ideal, because it means that you'll get duplicates if you run multiple times your generator.
The text was updated successfully, but these errors were encountered:
Hello,
As in #178 , #188 , #353 , the
append
action has a major problem when using regexp special characters in the template and whenunique
is set totrue
(orundefined
sincetrue
is the default value).In
node-plop
code there is:Since the
stringToAppend
variable is the rendered template without further manipulation, if the template contains some regexp special characters, the regexp might be invalid.For example, if you define as action:
And your
file.json
is:{ "elements": { } }
when executed it gives the following error:
Range out of order in character class.
(sincet-l
is an invalid character range). This can be fixed by using for example:template: '"list": \\[ "element-list" ];',
, but then the json generated is invalid (it prints literally"list": \[ "element-list" ]
), so adding escape characters is not an option.There was a PR fixing this: #330 but it was closed without merging.
If this happens to you, a temporary solution might be to explicitly set
unique: false
in your action configuration. But this is not ideal, because it means that you'll get duplicates if you run multiple times your generator.The text was updated successfully, but these errors were encountered: