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

Explore usage tracking #52

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Explore usage tracking #52

wants to merge 2 commits into from

Conversation

anthmatic
Copy link
Contributor

No description provided.

if (firstFile) {
trackUsage();
firstFile = false;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is executed for each file so this prevents trackUsage from being called multiple times

import { resolveConfigFile } from "prettier";

export const trackUsage = () => {
const rootPath = resolveConfigFile.sync();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks up the prettier config and we use that to try to find the HubSpot config.
It's not guaranteed to be in the a child directly alongside a hubspot.config.yml or even exist.


if (!validateConfig()) {
return;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO:

  • More logic to check isTrackingAllowed
  • Log message to user to let them know that tracking is enabled and how they can disable it (hubspot config)
  • Actually implement tracking. My current thought is that we'd spawn a detached child process to make the actual request

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.

1 participant