scaffolder
scaffolder copied to clipboard
Custom Transformers don't work
Hello
I put this into my scaffolder.config
module.exports = { transformers: { toUpperCaseNew: (parameterValue, context) => parameterValue.toUpperCase(), }, functions: { etc.
Then inside my scaffolder file i try to use toUpperCaseNew
export const {{tableName | toUpperCaseNew}} = (props) => {
When i run this
scaff create redux tableName=Fabian --folder MyCoolRedux
i get this error
Error while trying to apply the following transformation "toUpperCaseNew". You are probably missing a definition for the "toUpperCaseNew" transformer in your scaffolder.config.js file For more information about transformers check this out https://github.com/galElmalah/scaffolder#getting-started
I know i have toUpperCaseNew in my scaffolder.config.js file. I placed that file into the scaffolder folder.
It looks like it's not reading it or finding it.
Any tips would be appreciated.
Thank you
Fabian
Hey @fhanggi , can you share with me a reproducible example?
Ok I attached a zip file with a folder where you can reproduce this. i am opening the folder in vs code and in a terminal i run scaff create component componentName=CoolAFComponent --folder MyCoolComp
i then see this error
Error while trying to apply the following transformation "toUpperCaseNew". You are probably missing a definition for the "toUpperCaseNew" transformer in your scaffolder.config.js fil scaffTest.zip e
seems like you got some invalid values in your scaffolder.config.js
, in the bottom of the config you still got some left overs from the getting started guide
transformers: {...},
functions: {...},
parametersOptions: {...}
Removing that faulty code seems to be resolving the issue for me and the custom transformer is applied as expected
I removed everything except these lines but still get the same error
module.exports = { transformers: { toUpperCaseNew: (parameterValue, context) => parameterValue.toUpperCase() } };
i'm running node 12.13.1 and npm 6.14.8. Hope that is ok
Should be ok, ill take a closer look later today Which version of scaffolder are you running?
Hello
I am running 1.10.1. Installed in my global npm cache.
Thank you.
Hello, it's been a while. Could you please let me know if you found a solution for this issue?