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

[x-license] Introduce usage telemetry #13530

Merged
merged 67 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
db7dbdb
feat: add x-telemetry package to collect anonymous analytics
hasdfa Jun 10, 2024
af07f13
cleanup, organise, opt-in mechanism
hasdfa Jun 14, 2024
13e41b3
add README.md draft
hasdfa Jun 14, 2024
28249c2
update event payload
hasdfa Jun 20, 2024
ece6315
Merge remote-tracking branch 'upstream/master' into x-license/add-tel…
hasdfa Jun 20, 2024
f0a6600
add @mui/x-telemetry package, send licenseVerification once per session
hasdfa Jun 21, 2024
caff09e
remove compiled, use as dependencies
hasdfa Jun 21, 2024
0ac2fc0
license key hash, disable for ci, improve context
hasdfa Jun 24, 2024
9bf2d39
hash machine id internally
hasdfa Jun 24, 2024
2a27bcd
fix: lint, prettier
hasdfa Jun 24, 2024
d55225b
do not send license key
hasdfa Jul 10, 2024
8db1506
Merge remote-tracking branch 'origin/master' into x-license/add-telem…
hasdfa Jul 10, 2024
c167280
fix: pnpm-lock
hasdfa Jul 10, 2024
d8b72e4
Merge remote-tracking branch 'origin/master' into x-license/add-telem…
hasdfa Aug 14, 2024
dbac0ce
Merge master, fix eslint, prettier
hasdfa Aug 14, 2024
1036451
update telemetry domain
hasdfa Aug 14, 2024
2efc840
fix: docs
hasdfa Aug 14, 2024
40906b6
fix: webpackBaseConfig.js
hasdfa Aug 14, 2024
1079497
improve x-telemetry/README.md
hasdfa Aug 14, 2024
05d4aba
feat: fetch with retry
hasdfa Aug 14, 2024
3263b54
Merge remote-tracking branch 'origin/master' into x-license/add-telem…
hasdfa Oct 28, 2024
8062625
[x-telemetry] Architecture improvements, improve config
hasdfa Dec 9, 2024
496600c
[x-telemetry] Improve config support for nextjs
hasdfa Dec 9, 2024
6adaf71
[x-telemetry] Improvements
hasdfa Dec 13, 2024
9c2b241
Merge remote-tracking branch 'origin/master' into x-license/add-telem…
hasdfa Dec 13, 2024
b243b60
[telmetry] Improve compability with Node.js permissions api
hasdfa Dec 30, 2024
c29713e
Merge remote-tracking branch 'origin' into x-license/add-telemetry
hasdfa Dec 30, 2024
fd4f623
fix: pnpm dedupe
hasdfa Dec 30, 2024
978d0fd
fix get env info from import.meta
hasdfa Jan 13, 2025
496c3a2
Merge remote-tracking branch 'origin/master' into x-license/add-telem…
hasdfa Jan 13, 2025
40976db
fix config
hasdfa Jan 14, 2025
bf0b4ce
[x-telemetry] Improve readme, return get status from global object
hasdfa Feb 3, 2025
9f503c4
Merge remote-tracking branch 'origin/master' into x-license/add-telem…
hasdfa Feb 3, 2025
f40d374
Complete merge from master
hasdfa Feb 3, 2025
fef329d
[Telemetry] add guide doc
hasdfa Feb 3, 2025
a471d5e
fix pnpm docs:link-check
hasdfa Feb 3, 2025
e3528fd
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 3, 2025
8ab7d77
fix issues on doc
hasdfa Feb 3, 2025
19e142e
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 5, 2025
e2ed8b8
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 5, 2025
556db6b
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 9, 2025
4d80ebd
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 10, 2025
db6561a
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 20, 2025
ae01cef
Merge branch 'x-license/add-telemetry' of github.com:hasdfa/mui-x int…
hasdfa Feb 20, 2025
6d099ac
improvements, remove cli, cut bundle in production
hasdfa Feb 21, 2025
c5cc5eb
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 21, 2025
273cc90
[telemetry] Fix build scripts
hasdfa Feb 21, 2025
063d9ec
cleanup
hasdfa Feb 21, 2025
076f6f4
update x telemetry request
hasdfa Feb 25, 2025
46a3a04
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 25, 2025
aa0c680
Fix pnpm lock
hasdfa Feb 25, 2025
a677b58
fix docs:api
hasdfa Feb 25, 2025
ff6158b
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 25, 2025
fd6fc77
fix accessing import.meta directly
hasdfa Feb 25, 2025
4de1301
Merge branch 'x-license/add-telemetry' of github.com:hasdfa/mui-x int…
hasdfa Feb 25, 2025
086bd1f
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 25, 2025
51b3076
fix lint
hasdfa Feb 25, 2025
3dcd184
fix get browser fingerprint:
hasdfa Feb 25, 2025
ee3beda
fix: pnpm dedupe
hasdfa Feb 25, 2025
3f4a467
fix: remove unused console.log
hasdfa Feb 25, 2025
a13e68a
fix get context for non-browsers (e.g. unit tests)
hasdfa Feb 25, 2025
ad6d4ba
fix browser fingerprint
hasdfa Feb 25, 2025
a5e4a3f
Merge branch 'master' into x-license/add-telemetry
hasdfa Feb 25, 2025
00f7134
improve get machine id
hasdfa Feb 25, 2025
0829a35
Merge branch 'x-license/add-telemetry' of github.com:hasdfa/mui-x int…
hasdfa Feb 25, 2025
e59d1f2
debug telemetry env var for docs
hasdfa Feb 25, 2025
a53d92b
remove unused console.log
hasdfa Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node": "20",
"packages": [
"packages/x-license",
"packages/x-telemetry",
"packages/x-data-grid",
"packages/x-data-grid-pro",
"packages/x-data-grid-premium",
Expand All @@ -19,6 +20,7 @@
],
"publishDirectory": {
"@mui/x-license": "packages/x-license/build",
"@mui/x-telemetry": "packages/x-telemetry/build",
"@mui/x-data-grid": "packages/x-data-grid/build",
"@mui/x-data-grid-pro": "packages/x-data-grid-pro/build",
"@mui/x-data-grid-premium": "packages/x-data-grid-premium/build",
Expand Down
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ module.exports = {
],
},
},
{
files: ['packages/x-telemetry/**/*{.tsx,.ts,.js}'],
rules: {
'no-console': 'off',
},
},
...buildPackageRestrictedImports('@mui/x-charts', 'x-charts', false),
...buildPackageRestrictedImports('@mui/x-charts-pro', 'x-charts-pro', false),
...buildPackageRestrictedImports('@mui/x-codemod', 'x-codemod', false),
Expand All @@ -316,6 +322,7 @@ module.exports = {
...buildPackageRestrictedImports('@mui/x-tree-view', 'x-tree-view', false),
...buildPackageRestrictedImports('@mui/x-tree-view-pro', 'x-tree-view-pro', false),
...buildPackageRestrictedImports('@mui/x-license', 'x-license'),
...buildPackageRestrictedImports('@mui/x-telemetry', 'x-telemetry'),

...addReactCompilerRule(chartsPackages, ENABLE_REACT_COMPILER_PLUGIN_CHARTS),
...addReactCompilerRule(dataGridPackages, ENABLE_REACT_COMPILER_PLUGIN_DATA_GRID),
Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const defaultAlias = {
'@mui/x-data-grid-pro': resolveAliasPath('./packages/x-data-grid-pro/src'),
'@mui/x-data-grid-premium': resolveAliasPath('./packages/x-data-grid-premium/src'),
'@mui/x-license': resolveAliasPath('./packages/x-license/src'),
'@mui/x-telemetry': resolveAliasPath('./packages/x-telemetry/src'),
'@mui/x-date-pickers': resolveAliasPath('./packages/x-date-pickers/src'),
'@mui/x-date-pickers-pro': resolveAliasPath('./packages/x-date-pickers-pro/src'),
'@mui/x-charts': resolveAliasPath('./packages/x-charts/src'),
Expand Down
91 changes: 91 additions & 0 deletions docs/data/guides/telemetry/telemetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
packageName: '@mui/x-telemetry'
---

# MUI X Telemetry guide

<p class="description">MUI X Telemetry collects anonymous usage data to help improve the library. This guide will walk you through how to opt-in, opt-out, and configure telemetry.</p>

Check failure on line 7 in docs/data/guides/telemetry/telemetry.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.MuiBrandName] Use a non-breaking space (option+space on Mac, Alt+0160 on Windows or AltGr+Space on Linux, instead of space) for brand name ('MUI X' instead of 'MUI X') Raw Output: {"message": "[MUI.MuiBrandName] Use a non-breaking space (option+space on Mac, Alt+0160 on Windows or AltGr+Space on Linux, instead of space) for brand name ('MUI X' instead of 'MUI X')", "location": {"path": "docs/data/guides/telemetry/telemetry.md", "range": {"start": {"line": 7, "column": 24}}}, "severity": "ERROR"}

Check warning on line 7 in docs/data/guides/telemetry/telemetry.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.NoCompanyName] We avoid referencing the company name 'MUI X'. Instead you can reference a product or the team. Raw Output: {"message": "[MUI.NoCompanyName] We avoid referencing the company name 'MUI X'. Instead you can reference a product or the team.", "location": {"path": "docs/data/guides/telemetry/telemetry.md", "range": {"start": {"line": 7, "column": 24}}}, "severity": "WARNING"}

Check warning on line 7 in docs/data/guides/telemetry/telemetry.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/data/guides/telemetry/telemetry.md", "range": {"start": {"line": 7, "column": 110}}}, "severity": "WARNING"}

## Opting In
Copy link
Member

Choose a reason for hiding this comment

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

@joserodolfofreitas It would be great to have a few paragraphs here explaining what's the purpose of telemetry and why would users want to enable it.

Copy link
Member

Choose a reason for hiding this comment

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

I'll address this separately together with the blog post to announce telemetry to the public. For now, we can merge this for the internal testing.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## Opting In
## Opting in


Currently, **Telemetry is disabled by default**. To opt-in, you can use one of the following methods:

### Setting the Environment Variable

You can set the `MUI_X_TELEMETRY_DISABLED` environment variable to `false` to enable telemetry:

```bash
MUI_X_TELEMETRY_DISABLED=false
```

> Note that some frameworks may require you to prefix the environment variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.
Copy link
Member

Choose a reason for hiding this comment

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

This is not a quote.

Suggested change
> Note that some frameworks may require you to prefix the environment variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.
Note that some frameworks may require you to prefix the environment variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.


### Import telemetry settings from `@mui/x-license` package

You can use `muiXTelemetrySettings` to enable telemetry:

```js
import { muiXTelemetrySettings } from '@mui/x-license';

muiXTelemetrySettings.enableTelemetry();
```

### Setting the Flag in Your Application
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### Setting the Flag in Your Application
### Setting the flag in your application


You can set the `__MUI_X_TELEMETRY_DISABLED__` flag in your application to `false` to enable telemetry:

```js
import { ponyfillGlobal } from '@mui/utils';

ponyfillGlobal.__MUI_X_TELEMETRY_DISABLED__ = false;
```

### Using the CLI

You can use the `npx mui-x-telemetry` command to enable or disable telemetry:

```bash
npx mui-x-telemetry enable
```

## Opting Out
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## Opting Out
## Opting out


To opt-out of telemetry, you can use one of the following methods:

### Setting the Environment Variable

You can set the `MUI_X_TELEMETRY_DISABLED` environment variable to `true` to disable telemetry:

```bash
MUI_X_TELEMETRY_DISABLED=true
```

> Note that some frameworks may require you to prefix the environment variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.
Copy link
Member

Choose a reason for hiding this comment

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

Note a quote

Suggested change
> Note that some frameworks may require you to prefix the environment variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.
Note that some frameworks may require you to prefix the environment variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.


### Import telemetry settings from `@mui/x-license` package

You can use `muiXTelemetrySettings` to disable telemetry:

```js
import { muiXTelemetrySettings } from '@mui/x-license';

muiXTelemetrySettings.disableTelemetry();
```

### Setting the Flag in Your Application
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### Setting the Flag in Your Application
### Setting the flag in your application


You can set the `__MUI_X_TELEMETRY_DISABLED__` flag in your application to `true` to disable telemetry:

```js
import { ponyfillGlobal } from '@mui/utils';

ponyfillGlobal.__MUI_X_TELEMETRY_DISABLED__ = true;
```

### Using the CLI

You can use the `npx mui-x-telemetry` command to disable telemetry:

```bash
npx mui-x-telemetry disable
```
7 changes: 7 additions & 0 deletions docs/pages/x/guides/telemetry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from 'docsx/data/guides/telemetry/telemetry.md?muiMarkdown';

export default function Page() {
return <MarkdownDocs {...pageProps} disableAd />;
}
1 change: 1 addition & 0 deletions docs/public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/r/x-pro-svg-link https://mui.com/x/introduction/licensing/#pro-plan 302
/r/x-premium-svg https://mui.com/static/x/premium.svg 302
/r/x-premium-svg-link https://mui.com/x/introduction/licensing/#premium-plan 302
/r/x-telemetry-postinstall-troubleshoot https://github.com/mui/mui-x/issues/new?assignees=&labels=status%3A+waiting+for+maintainer%2Cbug+%F0%9F%90%9B&projects=&template=1.bug.yml&title=MUI+X+Telemetry+failed+to+make+initialization 302

# Legacy redirection
# Added in chronological order (the last line is the most recent one)
Expand Down
3 changes: 2 additions & 1 deletion packages/x-license/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"dependencies": {
"@babel/runtime": "^7.26.7",
"@mui/utils": "^5.16.6 || ^6.0.0",
"@mui/x-internals": "workspace:*"
"@mui/x-internals": "workspace:*",
"@mui/x-telemetry": "workspace:*"
},
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/x-license/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './verifyLicense';
export * from './useLicenseVerifier';
export * from './Watermark';
export * from './Unstable_LicenseInfoProvider';
export { muiXTelemetrySettings } from '@mui/x-telemetry';
15 changes: 14 additions & 1 deletion packages/x-license/src/useLicenseVerifier/useLicenseVerifier.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { sendMuiXTelemetryEvent, muiXTelemetryEvents } from '@mui/x-telemetry';
import { verifyLicense } from '../verifyLicense/verifyLicense';
import { LicenseInfo } from '../utils/licenseInfo';
import {
Expand Down Expand Up @@ -47,9 +48,21 @@ export function useLicenseVerifier(
licenseKey,
packageName,
});

const fullPackageName = `@mui/${packageName}`;

sendMuiXTelemetryEvent(
muiXTelemetryEvents.licenseVerification(
{
packageName,
packageReleaseInfo: releaseInfo,
licenseKey,
},
{
licenseStatus: licenseStatus?.status,
},
),
);

if (licenseStatus.status === LICENSE_STATUS.Valid) {
// Skip
} else if (licenseStatus.status === LICENSE_STATUS.Invalid) {
Expand Down
5 changes: 4 additions & 1 deletion packages/x-license/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"outDir": "build",
"rootDir": "./src"
},
"references": [{ "path": "../x-internals/tsconfig.build.json" }],
"references": [
{ "path": "../x-internals/tsconfig.build.json" },
{ "path": "../x-telemetry/tsconfig.build.json" }
],
"include": ["src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
11 changes: 11 additions & 0 deletions packages/x-telemetry/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Commercial License

Copyright (c) 2020 Material-UI SAS

MUI X Pro (https://mui.com/pricing/) is commercial software. You MUST agree to the
End User License Agreement (EULA: https://mui.com/r/x-license-eula) to be able to
use the software.

This means that you either need to purchase a commercial license at
https://mui.com/r/x-get-license?scope=pro or be eligible for the Evaluation (trial)
licenses detailed at https://mui.com/r/x-license-trial.
99 changes: 99 additions & 0 deletions packages/x-telemetry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# @mui/x-telemetry
Copy link
Member

Choose a reason for hiding this comment

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

Likely to move to a dedicated docs page


Package used by some of MUI X to collects **anonymous** telemetry data about general usage. Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information.

## How to opt-in

Currently, **it's disabled by default,** and you could opt-in to it in 3 ways:

1. By using CLI util to enable/disable it for the current machine.

```shell
npx mui-x-telemetry enable
# or
npx mui-x-telemetry disable
```

2. By setting it directly to package settings on the application start (e.g. in main file).

Check failure on line 17 in packages/x-telemetry/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.CorrectRererenceCased] Use 'e.g.' instead of 'e.g' Raw Output: {"message": "[MUI.CorrectRererenceCased] Use 'e.g.' instead of 'e.g'", "location": {"path": "packages/x-telemetry/README.md", "range": {"start": {"line": 17, "column": 73}}}, "severity": "ERROR"}

Check failure on line 17 in packages/x-telemetry/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.GoogleLatin] Use 'for example' instead of 'e.g.' Raw Output: {"message": "[MUI.GoogleLatin] Use 'for example' instead of 'e.g.'", "location": {"path": "packages/x-telemetry/README.md", "range": {"start": {"line": 17, "column": 73}}}, "severity": "ERROR"}

```js
import { muiXTelemetrySettings } from '@mui/x-telemetry';
// or
import { muiXTelemetrySettings } from '@mui/x-license';

muiXTelemetrySettings.enableTelemetry(); // to enable telemetry collection and sending
// or
muiXTelemetrySettings.disableTelemetry(); // to disable telemetry collection and sending
```

3. By setting the environment variable.

```dotenv
MUI_X_TELEMETRY_DISABLED=false # Enable telemetry
# or
MUI_X_TELEMETRY_DISABLED=true # Enable telemetry
```

> ⚠️ Note that some frameworks requires to prefix the variable with `REACT_APP_`, `NEXT_PUBLIC_`, etc.

4. By setting the flag to global object on the application start (e.g. in main file).

Check failure on line 39 in packages/x-telemetry/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.CorrectRererenceCased] Use 'e.g.' instead of 'e.g' Raw Output: {"message": "[MUI.CorrectRererenceCased] Use 'e.g.' instead of 'e.g'", "location": {"path": "packages/x-telemetry/README.md", "range": {"start": {"line": 39, "column": 67}}}, "severity": "ERROR"}

Check failure on line 39 in packages/x-telemetry/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.GoogleLatin] Use 'for example' instead of 'e.g.' Raw Output: {"message": "[MUI.GoogleLatin] Use 'for example' instead of 'e.g.'", "location": {"path": "packages/x-telemetry/README.md", "range": {"start": {"line": 39, "column": 67}}}, "severity": "ERROR"}

```js
import { ponyfillGlobal } from '@mui/utils';

ponyfillGlobal.__MUI_X_TELEMETRY_DISABLED__ = false; // enabled
// or
ponyfillGlobal.__MUI_X_TELEMETRY_DISABLED__ = true; // disabled
```

OR

```js
if (typeof window !== 'undefined') {
window.__MUI_X_TELEMETRY_DISABLED__ = false; // enabled
}
// or
if (typeof window !== 'undefined') {
window.__MUI_X_TELEMETRY_DISABLED__ = true; // disabled
}
```

## CLI util

The purpose of this utility is to enable/disable telemetry for the current machine.

### Possible commands

```bash
npx mui-x-telemetry <command>

Commands:
npx mui-x-telemetry enable Enable MUI X telemetry
npx mui-x-telemetry disable Disable MUI X telemetry
npx mui-x-telemetry status Check the status of MUI X telemetry
npx mui-x-telemetry config Get path where the global config is stored

Options:
--help Show help [boolean]
```

### How to enable

```shell
$ npx mui-x-telemetry enable
[telemetry] MUI X telemetry enabled
```

### How to disable

```shell
$ npx mui-x-telemetry disable
[telemetry] MUI X telemetry disabled
```

### How to current status

```shell
$ npx mui-x-telemetry status
[telemetry] MUI X telemetry is enabled
```
56 changes: 56 additions & 0 deletions packages/x-telemetry/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@mui/x-telemetry",
"version": "8.0.0-alpha.10",
"description": "MUI X Telemetry",
"author": "MUI Team",
"main": "src/index.ts",
"license": "SEE LICENSE IN LICENSE",
"bugs": {
"url": "https://github.com/mui/mui-x/issues"
},
"homepage": "https://mui.com/x/guide/telemetry/",
"publishConfig": {
"access": "public",
"directory": "build"
},
"scripts": {
"typescript": "tsc -p tsconfig.json",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files ",
"build:modern": "node ../../scripts/build.mjs modern",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:copy-files": "node ../../scripts/copyFiles.mjs && node ./scripts/addPackageScripts.js",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo"
},
"sideEffects": false,
"bin": {
"mui-x-telemetry": "cli/index.js"
},
"packageScripts": {
"postinstall": "node ./postinstall/index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/mui/mui-x.git",
"directory": "packages/x-telemetry"
},
"dependencies": {
"@babel/runtime": "^7.26.7",
"@mui/utils": "^5.16.6 || ^6.0.0",
"ci-info": "^4.0.0",
"conf": "^5.0.0",
"device-uuid": "^1.0.4",
"is-docker": "^2.2.1",
"node-machine-id": "^1.1.12",
"yargs": "^17.7.2"
},
"devDependencies": {
"@mui/internal-test-utils": "^1.0.26",
"@types/device-uuid": "^1.0.3",
"rimraf": "^6.0.1"
},
"engines": {
"node": ">=14.0.0"
}
}
19 changes: 19 additions & 0 deletions packages/x-telemetry/scripts/addPackageScripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs');
const path = require('path');

const packageDir = process.cwd();

const packageJsonPath = path.join(packageDir, 'package.json');
const packageJsonFileContent = fs.readFileSync(packageJsonPath, 'utf8');
const packageJson = JSON.parse(packageJsonFileContent);

if (packageJson.packageScripts) {
const buildPackageJsonPath = path.join(packageDir, 'build/package.json');
const buildPackageJsonFileContent = fs.readFileSync(buildPackageJsonPath, 'utf8');
const buildPackageJson = JSON.parse(buildPackageJsonFileContent);

buildPackageJson.scripts = packageJson.packageScripts;
delete buildPackageJson.packageScripts;

fs.writeFileSync(buildPackageJsonPath, JSON.stringify(buildPackageJson, null, 2));
}
Loading
Loading