question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support shareable custom usage data

See original GitHub issue

I would like to create a shareable Browserslist config package that can be reused/shared across multiple projects. I am able to do this just fine except if I want to use custom usage data ('my stats') that is relative to the shareable config rather than relative to projects whose Browserslist configs extend the shareable config.

Here is what I am trying to achieve:

  1. Shareable Browserslist config package contains index.js (the config-exporting module), a browserslist-stats.json file, and a package.json file (for installation via npm/Yarn). The config in the package should include a query to use custom usage data resolving to the browserslist-stats.json file in this package, not to the browserslist-stats.json file in whatever project extends this shareable config.
  2. Install shareable Browserslist config package and include 'extends browserslist-config-mypackage' in browserslist query passed to other tools (postcss-preset-env and babel-preset-env in my case).

When I do this, I get the error message BrowserslistError: Custom usage statistics was not provided (unless I include a browserslist-stats.json file in my project, but that does not satisfy what I am trying to achieve).

It is probably good to preserve the current meaning of 'my stats' and how it is resolved for backwards compatibility but also so that a shareable config can still indicate that the target config should use its own custom usage data.

Here is one idea. Maybe 'my' could be replaced in any query with the name of a package containing a browserslist-stats.json file? For example:

browserslist-config-mypackage/index.js:

module.exports = [
  '> 0.5% in my stats', // custom usage data resolves to browserslist-stats.json corresponding to whichever config extends this config. In the case of chained extends, custom usage data resolves relative to the config at the end of the chain. This is the current behavior right?
  '> 1% in browserslist-config-mypackage stats' // custom usage data resolves to browserslist-stats.json in this package
];

Browserslist query in project:

[
  'extends browserslist-config-mypackage',
  '> 0.5% in browserslist-config-mypackage stats', // This would NOT be redundant
  '> 1% in browserslist-config-mypackage stats', // This WOULD be redundant
  '> 5% in browserslist-config-google stats', // Presumably there would be no limit to how many sources of custom usage data you could use in queries
  '> 5% in browserslist-config-wordpress stats'
]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Nov 30, 2019

Released in 4.8.

1reaction
aicommented, Nov 27, 2019

That could work, presumably you would be able to use the > 5% in browserslist-config-google stats within browserslist-config-google itself?

Yeap.

Also what about custom stats file names, would this just enforce browserslist-stats.json?

Let’s force one name. I do not see any problem with this convention.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data sharing settings - Analytics Help - Google Support
These settings let you customize how you share with Google the data that you collect using an Analytics data collection method (like the...
Read more >
Custom Usage Metrics Reporting - - PowerBI.Tips
This is a cool trick you can use to customize the Power BI report usage metrics report. Use this trick to get more...
Read more >
Monitor usage metrics in workspaces (preview) - Power BI
Now you can create and share custom usage reports, all from the same Usage Metrics Report dataset.
Read more >
If an app asks to track your activity - Apple Support
App Tracking Transparency allows you to choose whether an app can track your activity across other companies' apps and websites for the ...
Read more >
browserslist/browserslist: Share target browsers ... - GitHub
Tools; Best Practices; Queries; Config File; Shareable Configs; Configuring for Different Environments; Custom Usage Data; JS API; Environment Variables ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found