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

feat(nuxt3): rewrite with nuxt kit #47

Closed
wants to merge 20 commits into from
Closed

feat(nuxt3): rewrite with nuxt kit #47

wants to merge 20 commits into from

Conversation

Baroshem
Copy link
Collaborator

@Baroshem Baroshem commented Mar 29, 2022

In this PR I wanted to introduce some Breaking Changes for the configuration of the module for both Google Analytics and Vercel Analytics.

I wanted to add both these variables as a part of the module config options like this:

interface ModuleOptions {
  provider: 'log' | 'vercel' | 'ga';
  debug: boolean;
  disabled: boolean;
  options: {
    googleMeasurementId: '123test',  // <- for Google Analytics
    vercelAnalyticsDsn: '123test'  // <- for Vercel Analytics
  }
}

Apart from that, no other BC are introduced in the migration and the module should work for all nuxt.js projects due to usage of module-builder.

@Baroshem Baroshem marked this pull request as draft March 29, 2022 09:01
@Baroshem Baroshem marked this pull request as ready for review April 5, 2022 09:49
@Baroshem Baroshem requested review from pi0, atinux and danielroe April 5, 2022 09:49
@pi0 pi0 self-assigned this Apr 5, 2022
Copy link
Contributor

@atinux atinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love to know @pi0 thoughts on my comments

@Baroshem
Copy link
Collaborator Author

Baroshem commented Jul 1, 2022

@pi0 @atinux @danielroe I have added all recommendations from you :)

package.json Outdated
"access": "public"
},
"homepage": "https://github.com/nuxt-community/web-vitals-module#readme",
"directories": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it is used for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there before, I can remove it :)

configKey: 'webVitals'
},
defaults: {
provider: 'log',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already setting default to log in L44 :)

console.error('[nuxt vitals]', err) // eslint-disable-line no-console
}

export function logDebug (label, ...args) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you removed log utils? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was used in one place and basically had the same purpose as regular console.log.

Baroshem and others added 4 commits July 1, 2022 12:50
Co-authored-by: pooya parsa <pyapar@gmail.com>
Co-authored-by: pooya parsa <pyapar@gmail.com>
Co-authored-by: pooya parsa <pyapar@gmail.com>
Co-authored-by: pooya parsa <pyapar@gmail.com>
Baroshem and others added 2 commits July 1, 2022 12:50
Co-authored-by: pooya parsa <pyapar@gmail.com>
@Baroshem
Copy link
Collaborator Author

Baroshem commented Jul 6, 2022

@pi0 @atinux @danielroe

I have updated the PR with the recent recommendations.

@atinux
Copy link
Contributor

atinux commented Jul 11, 2022

Would be nice to have an edge release in order to try it out :)

@Baroshem
Copy link
Collaborator Author

@atinux Could you explain what do you mean about edge release?

I just created a PR with a update to Nuxt 3 so i dont have access to deploy the package. I believe it would be up to @pi0 to do that

@atinux
Copy link
Contributor

atinux commented Aug 3, 2022

I was thinking that you could try to release on a nuxt-webvitals-module to try it for example.

Do you mind resolving the conflicts @Baroshem ?

@pi0 pi0 changed the title feat(nuxt3): update to Nuxt 3 compatibility feat(nuxt3): rewrite with nuxt kit Aug 3, 2022
@pi0
Copy link
Contributor

pi0 commented Aug 3, 2022

Current module should be compatible with Nuxt 3. I'm holding on this PR to properly test for Nuxt 3 and Nuxt 2 compatibility (vercel auto installs this module on deployments) and also check provider resolution changes.

Copy link
Contributor

atinux commented Aug 3, 2022

This is why I was thinking of an edge deployment to test on Vercel for example on one of our Nuxt 3 projects, how to test it otherwise?

@AndrewBogdanovTSS
Copy link

Hi guys, any updates on this one?

Copy link
Contributor

atinux commented Nov 2, 2022

So far the module is working also on Nuxt 3.

I would personally vote to have a branch for Nuxt 2 and another one for Nuxt 3 for simplicity.

@yanghanlin yanghanlin mentioned this pull request Nov 22, 2022
@pi0 pi0 mentioned this pull request Nov 28, 2022
@pi0 pi0 closed this in #59 Nov 28, 2022
@pi0
Copy link
Contributor

pi0 commented Nov 28, 2022

@Baroshem I reworked migration to kit with 3.0.0 compatibility in #59 to be without breaking changes and remain nuxt 2 compatible (mainly because vercel is injecting this module automatically).

Your PR included some more changes and type improvements that were conflicting. Feel free to rework them as smaller PRs and thanks again for time spent on this migration ❤️

@pi0 pi0 deleted the next branch November 28, 2022 15:01
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

Successfully merging this pull request may close these issues.

5 participants