-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add NuxtJS support #4
Conversation
* **README.md** - Update usage instructions to include Nuxt v3 support * **package.json** - Add Nuxt v3 dependencies * **src/cli.tsx** - Add check for Nuxt v3 projects - Update prompts to handle Nuxt v3 projects * **src/utils.ts** - Add function to check for Nuxt v3 projects * **templates/nuxt3** - Add Nuxt v3 webhook route template - Add Nuxt v3 checkout confirmation page template - Add Nuxt v3 checkout route template - Add Nuxt v3 Polar client template - Add Nuxt v3 products page template
* **Import** - Import `isNuxtDirectory` from `utils.js` * **Precheck** - Add check for Nuxt v3 projects in `precheck` function - Update error message to include Nuxt v3 projects * **Precheck Disclaimer** - Update spinner label to include Nuxt v3 projects
* **src/utils.ts** - Add `src/pages` to `nuxtIndicators` in `isNuxtDirectory` function * **src/template.ts** - Add `pages` and `src/pages` to `resolveAppDirectory` function - Update error message to include `pages` and `src/pages` directories
* **src/cli.tsx** - Add checks for Nuxt v3 projects - Update prompts to handle Nuxt v3 projects - Copy Nuxt templates if the project is a Nuxt project * **src/template.ts** - Update `copyProductsTemplate`, `copyCheckoutTemplate`, and `copyWebhooksTemplate` to handle Nuxt v3 projects - Add framework parameter to template copy functions
Ran @emilwidlund would you be able to test this branch against a NextJS project to make sure there are no regressions? |
@unibeck Amazing! Very much appreciated! Will take a look at this today. |
@unibeck Looks really good! I'm however encountering an issue when running the nuxt-starter. ![]() Looks like something is a little off with that |
Also, it would be nice if we somehow could pre-populate the polarOrgId in the runtimeConfig automatically. |
Ah this is how Let me look into the pre-populating |
I fixed the polar util issue. As for pre-populating the values in runtimeConfig, I did add the
I tried automating this, though it gets convoluted very quickly. We would need to support each |
@unibeck Nice work! I'm going to merge this. I'll add a few tweaks in regards to notifying about manually adding the runtimeConfig, etc. I'll issue a new release to NPM once I have that in place. Thanks again! Really nice to see this evolve & to support multiple types of frameworks going forward :) |
Thanks Emil! I'll keep an eye out for the release to share with the Nuxt community and on X. |
Added NuxtJS support. The biggest difference from the Next impl is the use of Nuxt's server api routes to handle Polar SDK. In Nuxt, this is how we keep PATs server-side and hidden from the user.
This impl makes some assumptions, based on what I deem a typical Nuxt project:
useRuntimeConfig
for secret handling