Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Transformers don't work #83

Open
fhanggi opened this issue Mar 23, 2022 · 8 comments
Open

Custom Transformers don't work #83

fhanggi opened this issue Mar 23, 2022 · 8 comments

Comments

@fhanggi
Copy link

fhanggi commented Mar 23, 2022

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

@galElmalah
Copy link
Owner

Hey @fhanggi , can you share with me a reproducible example?

@fhanggi
Copy link
Author

fhanggi commented Mar 23, 2022

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

@galElmalah
Copy link
Owner

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: {...}

@galElmalah
Copy link
Owner

Removing that faulty code seems to be resolving the issue for me and the custom transformer is applied as expected

@fhanggi
Copy link
Author

fhanggi commented Mar 23, 2022

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

@galElmalah
Copy link
Owner

galElmalah commented Mar 24, 2022

Should be ok, ill take a closer look later today
Which version of scaffolder are you running?

@fhanggi
Copy link
Author

fhanggi commented Mar 24, 2022

Hello

I am running 1.10.1. Installed in my global npm cache.

Thank you.

@fhanggi
Copy link
Author

fhanggi commented Jul 20, 2022

Hello, it's been a while. Could you please let me know if you found a solution for this issue?

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

No branches or pull requests

2 participants