Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

Multiple soyToImport configs #13

Closed
jbalsas opened this issue Dec 11, 2017 · 2 comments · Fixed by #14
Closed

Multiple soyToImport configs #13

jbalsas opened this issue Dec 11, 2017 · 2 comments · Fixed by #14

Comments

@jbalsas
Copy link
Contributor

jbalsas commented Dec 11, 2017

Currently, we support just one pair

  "callToImportRegex": "(\\S+)",
  "callToImportReplace": "{$1|param}"

This can be problematic if different types of imports are mixed in the same project, making it really hard to adapt. We could try to

Have synced arrays

callToImportRegex: string|array<string>
callToImportReplace: string|array<string>

Or move this directly to an array of regex,replace pairs

callToImport: [
    {
        regex: /regex1/,
        replace: 'replace1'
    }, {
        regex: /regex2/,
        replace: 'replace2'
    }
]

I'm not sure if anyone other than us is using the old syntax. The new one feels more robust. We could try to deprecate the old one, or just break it and release a major change if we don't care about maintaining that.

Thoughts, @Robert-Frampton, @mthadley?

@robframpton
Copy link

Seems fine to just update the API and do a major release.

It would also be really easy to just map callToImportRegex and callToImportReplace to the new API if they are found in a .soycriticrc.json file, and maybe print a warning to update it.

@mthadley
Copy link
Collaborator

@Robert-Frampton Yup, totally agree. It should be an easy addition. 💯

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants