chrisvdm / redwoodjs-stripe

A Redwood/Stripe integration made easy
MIT License
46 stars 7 forks source link

fix: don't generate demo page twice #104

Closed jtoar closed 1 year ago

jtoar commented 1 year ago

@chrisvdm I'm not sure if we need to generate the StripeDemo page anymore? When I first ran npx @redwoodjs-stripe/cli@latest setup, I got this error on yarn rw dev:

image

I discovered that there's two pages in web/src/pages/StripeDemoPage. It seems like one is coming from yarn rw g page StripeDemo and the other is coming from copying the templates:

image

This error may only appear in TS projects where the generate command generates a .tsx file while copying the template copies over a .js file.

jtoar commented 1 year ago

I think I see why you used the generate command—to get the route listed in the Routes.tsx file. In that case maybe we do keep the yarn rw g page stripeDemo line, but it needs to handle TS projects

chrisvdm commented 1 year ago

@tjoar, I think maybe we can hack it by finding out whether the app is TS and then change file extension accordingly so that at least there are no duplicates idk

brahyam commented 1 year ago

Got the same issue now while testing the plugin and was able to solve it by erasing the generated StripeDemoPage.tsx file, thanks.

It might help to have the error "Module parse failed: Identifier 'StripeDemoPage' has already been declared" here in text so others can find this issue if they search for those words.

chrisvdm commented 1 year ago

Fixed the double generation here: https://github.com/chrisvdm/redwoodjs-stripe/pull/113. For now it just skips generating a new stripeDemoPage