Skip to content

Commit

Permalink
[license] Rename @mui/x-license-pro to @mui/x-license (#11938)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii authored Feb 6, 2024
1 parent 603e688 commit 8394944
Show file tree
Hide file tree
Showing 64 changed files with 83 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"installCommand": "install:codesandbox",
"node": "18",
"packages": [
"packages/x-license-pro",
"packages/x-license",
"packages/grid/x-data-grid",
"packages/grid/x-data-grid-pro",
"packages/grid/x-data-grid-premium",
Expand All @@ -14,7 +14,7 @@
"packages/x-tree-view"
],
"publishDirectory": {
"@mui/x-license-pro": "packages/x-license-pro/build",
"@mui/x-license": "packages/x-license/build",
"@mui/x-data-grid": "packages/grid/x-data-grid/build",
"@mui/x-data-grid-pro": "packages/grid/x-data-grid-pro/build",
"@mui/x-data-grid-premium": "packages/grid/x-data-grid-premium/build",
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ module.exports = {
buildPackageRestrictedImports('@mui/x-data-grid-generator', 'grid/x-data-grid-generator'),
buildPackageRestrictedImports('@mui/x-pickers', 'x-pickers'),
buildPackageRestrictedImports('@mui/x-pickers-pro', 'x-pickers-pro'),
buildPackageRestrictedImports('@mui/x-license-pro', 'x-license-pro'),
buildPackageRestrictedImports('@mui/x-license', 'x-license'),
],
};
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const generateReleaseInfo = require('./packages/x-license-pro/generateReleaseInfo');
const generateReleaseInfo = require('./packages/x-license/generateReleaseInfo');

function resolveAliasPath(relativeToBabelConf) {
const resolvedPath = path.relative(process.cwd(), path.resolve(__dirname, relativeToBabelConf));
Expand All @@ -11,7 +11,7 @@ const defaultAlias = {
'@mui/x-data-grid-generator': resolveAliasPath('./packages/grid/x-data-grid-generator/src'),
'@mui/x-data-grid-pro': resolveAliasPath('./packages/grid/x-data-grid-pro/src'),
'@mui/x-data-grid-premium': resolveAliasPath('./packages/grid/x-data-grid-premium/src'),
'@mui/x-license-pro': resolveAliasPath('./packages/x-license-pro/src'),
'@mui/x-license': resolveAliasPath('./packages/x-license/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
2 changes: 1 addition & 1 deletion docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const alias = {
'@mui/x-date-pickers-pro': '../packages/x-date-pickers-pro/src',
'@mui/x-charts': '../packages/x-charts/src',
'@mui/x-tree-view': '../packages/x-tree-view/src',
'@mui/x-license-pro': '../packages/x-license-pro/src',
'@mui/x-license': '../packages/x-license/src',
'@mui/docs': '../node_modules/@mui/monorepo/packages/mui-docs/src',
'@mui/markdown': '../node_modules/@mui/monorepo/packages/markdown',
'@mui/monorepo': '../node_modules/@mui/monorepo',
Expand Down
12 changes: 6 additions & 6 deletions docs/data/introduction/licensing/licensing.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ If this isn't possible, please contact [email protected] to request a compatible lic

### How to install the key

The license key depends on a package called `@mui/x-license-{plan}` that validates whether or not it's active.
The license key depends on a package called `@mui/x-license` that validates whether or not it's active.
Once you have your license key, import the `LicenseInfo` method from that package and call the `setLicenseKey()` function:

```jsx
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';

LicenseInfo.setLicenseKey('YOUR_LICENSE_KEY');
```
Expand All @@ -164,7 +164,7 @@ When using Next.js App Router, you have multiple options to install the license

```tsx
'use client';
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';

LicenseInfo.setLicenseKey('YOUR_LICENSE_KEY');
```
Expand All @@ -173,7 +173,7 @@ LicenseInfo.setLicenseKey('YOUR_LICENSE_KEY');

```tsx
'use client';
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';

LicenseInfo.setLicenseKey('YOUR_LICENSE_KEY');

Expand Down Expand Up @@ -204,7 +204,7 @@ export default function RootLayout(props: { children: React.ReactNode }) {
When using Next.js pages, a great place to call `setLicenseKey` is in [`_app.js`](https://nextjs.org/docs/pages/building-your-application/routing/custom-app).

```tsx
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';

LicenseInfo.setLicenseKey('YOUR_LICENSE_KEY');

Expand All @@ -225,7 +225,7 @@ The license key is validated on the server and client side so you must expose th
To do this, you need to prefix the environment variables with `NEXT_PUBLIC_` as explained in the [Next.js documentation](https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser):

```tsx
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';

LicenseInfo.setLicenseKey(process.env.NEXT_PUBLIC_MUI_X_LICENSE_KEY);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ In `package.json`, change the version of the data grid package to `next`.
```diff
-"@mui/x-data-grid": "6.x.x",
+"@mui/x-data-grid": "next",
-"@mui/x-data-grid-pro": "6.x.x",
+"@mui/x-data-grid-pro": "next",
-"@mui/x-data-grid-premium": "6.x.x",
+"@mui/x-data-grid-premium": "next",
```

Since v7 is a major release, it contains changes that affect the public API.
Expand All @@ -31,6 +35,22 @@ To have the option of using the latest API from `@mui/material`, the package pee
It is a change in minor version only, so it should not cause any breaking changes.
Please update your `@mui/material` package to this or a newer version.

## Update the license package

If you're using the commercial version of the Data Grid ([Pro](/x/introduction/licensing/#pro-plan) and [Premium](/x/introduction/licensing/#premium-plan) plans), you need to update the import path:

```diff
-import { LicenseInfo } from '@mui/x-license-pro';
+import { LicenseInfo } from '@mui/x-license';
```

If you have `@mui/x-license-pro` in the `dependencies` section of your `package.json`, rename and update the license package to the latest version:

```diff
-"@mui/x-license-pro": "6.x.x",
+"@mui/x-license": "next",
```

## Run codemods

The `preset-safe` codemod will automatically adjust the bulk of your code to account for breaking changes in v7.
Expand Down
16 changes: 16 additions & 0 deletions docs/data/migration/migration-pickers-v6/migration-pickers-v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ To have the option of using the latest API from `@mui/material`, the package pee
It is a change in minor version only, so it should not cause any breaking changes.
Please update your `@mui/material` package to this or a newer version.

## Update the license package

If you're using the commercial version of the Pickers ([Pro](/x/introduction/licensing/#pro-plan) plan), you need to update the import path:

```diff
-import { LicenseInfo } from '@mui/x-license-pro';
+import { LicenseInfo } from '@mui/x-license';
```

If you have `@mui/x-license-pro` in the `dependencies` section of your `package.json`, rename and update the license package to the latest version:

```diff
-"@mui/x-license-pro": "6.x.x",
+"@mui/x-license": "next",
```

## Run codemods

The `preset-safe` codemod will automatically adjust the bulk of your code to account for breaking changes in v7. You can run `v7.0.0/pickers/preset-safe` targeting only Date and Time Pickers or `v7.0.0/preset-safe` to target Data Grid as well.
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import DocsStyledEngineProvider from 'docs/src/modules/utils/StyledEngineProvide
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import createEmotionCache from 'docs/src/createEmotionCache';
import findActivePage from 'docs/src/modules/utils/findActivePage';
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';
import getProductInfoFromUrl from 'docs/src/modules/utils/getProductInfoFromUrl';

// Remove the license warning from demonstration purposes
Expand Down
8 changes: 4 additions & 4 deletions docs/scripts/createXTypeScriptProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface XTypeScriptProject extends Omit<TypeScriptProject, 'name'> {
}

export type XProjectNames =
| 'x-license-pro'
| 'x-license'
| 'x-data-grid'
| 'x-data-grid-pro'
| 'x-data-grid-premium'
Expand Down Expand Up @@ -117,10 +117,10 @@ export const createXTypeScriptProjects = () => {
const projects: XTypeScriptProjects = new Map();

projects.set(
'x-license-pro',
'x-license',
createXTypeScriptProject({
name: 'x-license-pro',
rootPath: path.join(workspaceRoot, 'packages/x-license-pro'),
name: 'x-license',
rootPath: path.join(workspaceRoot, 'packages/x-license'),
entryPointPath: 'src/index.ts',
documentationFolderName: 'license',
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid-premium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@mui/utils": "^5.15.7",
"@mui/x-data-grid": "7.0.0-beta.1",
"@mui/x-data-grid-pro": "7.0.0-beta.1",
"@mui/x-license-pro": "7.0.0-beta.0",
"@mui/x-license": "7.0.0-beta.0",
"@types/format-util": "^1.0.4",
"clsx": "^2.1.0",
"exceljs": "^4.4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
import { useLicenseVerifier, Watermark } from '@mui/x-license';
import {
GridBody,
GridFooterPlaceholder,
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid-premium/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './typeOverloads';

export { LicenseInfo } from '@mui/x-license-pro';
export { LicenseInfo } from '@mui/x-license';
export * from '@mui/x-data-grid/components';
export * from '@mui/x-data-grid-pro/components';
export * from '@mui/x-data-grid/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import addYears from 'date-fns/addYears';
import { expect } from 'chai';
import { createRenderer, screen, waitFor } from '@mui-internal/test-utils';
import { DataGridPremium } from '@mui/x-data-grid-premium';
import { generateLicense, LicenseInfo } from '@mui/x-license-pro';
import { generateLicense, LicenseInfo } from '@mui/x-license';

describe('<DataGridPremium /> - License', () => {
const { render } = createRenderer();
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid-premium/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"references": [
{ "path": "../x-data-grid/tsconfig.build.json" },
{ "path": "../x-data-grid-pro/tsconfig.build.json" },
{ "path": "../../x-license-pro/tsconfig.build.json" }
{ "path": "../../x-license/tsconfig.build.json" }
],
"include": ["src/**/*.ts*", "../../../node_modules/@mui/material/themeCssVarsAugmentation"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@mui/system": "^5.15.7",
"@mui/utils": "^5.15.7",
"@mui/x-data-grid": "7.0.0-beta.1",
"@mui/x-license-pro": "7.0.0-beta.0",
"@mui/x-license": "7.0.0-beta.0",
"@types/format-util": "^1.0.4",
"clsx": "^2.1.0",
"prop-types": "^15.8.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
import { useLicenseVerifier, Watermark } from '@mui/x-license';
import {
GridBody,
GridFooterPlaceholder,
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid-pro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './typeOverloads';

export { LicenseInfo } from '@mui/x-license-pro';
export { LicenseInfo } from '@mui/x-license';
export * from '@mui/x-data-grid/components';
export * from '@mui/x-data-grid/constants';
export * from '@mui/x-data-grid/hooks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { expect } from 'chai';
import { createRenderer, screen, waitFor } from '@mui-internal/test-utils';
import { DataGridPro } from '@mui/x-data-grid-pro';
import { LicenseInfo } from '@mui/x-license-pro';
import { LicenseInfo } from '@mui/x-license';

describe('<DataGridPro /> - License', () => {
const { render } = createRenderer();
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid-pro/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"references": [
{ "path": "../x-data-grid/tsconfig.build.json" },
{ "path": "../../x-license-pro/tsconfig.build.json" }
{ "path": "../../x-license/tsconfig.build.json" }
],
"include": ["src/**/*.ts*", "../../../node_modules/@mui/material/themeCssVarsAugmentation"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"outDir": "build",
"rootDir": "./src"
},
"references": [{ "path": "../x-license-pro/tsconfig.build.json" }],
"references": [{ "path": "../x-license/tsconfig.build.json" }],
"include": ["src/**/*.ts*", "../../node_modules/@mui/material/themeCssVarsAugmentation"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*", "src/tests/**/*"]
}
2 changes: 1 addition & 1 deletion packages/x-date-pickers-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@mui/system": "^5.15.7",
"@mui/utils": "^5.15.7",
"@mui/x-date-pickers": "7.0.0-beta.1",
"@mui/x-license-pro": "7.0.0-beta.0",
"@mui/x-license": "7.0.0-beta.0",
"clsx": "^2.1.0",
"prop-types": "^15.8.1",
"react-transition-group": "^4.4.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useMediaQuery from '@mui/material/useMediaQuery';
import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
import { styled, useThemeProps } from '@mui/material/styles';
import { unstable_composeClasses as composeClasses } from '@mui/utils';
import { Watermark } from '@mui/x-license-pro';
import { Watermark } from '@mui/x-license';
import {
PickersCalendarHeader,
PickersCalendarHeaderProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { useLicenseVerifier } from '@mui/x-license-pro';
import { useLicenseVerifier } from '@mui/x-license';
import { alpha, styled, useThemeProps } from '@mui/material/styles';
import { unstable_composeClasses as composeClasses } from '@mui/utils';
import { useUtils } from '@mui/x-date-pickers/internals';
Expand Down
2 changes: 1 addition & 1 deletion packages/x-date-pickers-pro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { LicenseInfo } from '@mui/x-license-pro';
export { LicenseInfo } from '@mui/x-license';
export * from '@mui/x-date-pickers';

export * from './DateRangePickerDay';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { useSlotProps } from '@mui/base/utils';
import { useLicenseVerifier } from '@mui/x-license-pro';
import { useLicenseVerifier } from '@mui/x-license';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { PickersLayout, PickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { useSlotProps } from '@mui/base/utils';
import { useLicenseVerifier } from '@mui/x-license-pro';
import { useLicenseVerifier } from '@mui/x-license';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { PickersLayout, PickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/x-date-pickers-pro/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"references": [
{ "path": "../x-date-pickers/tsconfig.build.json" },
{ "path": "../x-license-pro/tsconfig.build.json" }
{ "path": "../x-license/tsconfig.build.json" }
],
"include": [
"./src/**/*.ts*",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @mui/x-license-pro
# @mui/x-license

Package used by all MUI X to validate license.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@mui/x-license-pro",
"name": "@mui/x-license",
"version": "7.0.0-beta.0",
"description": "MUI X License verification",
"author": "MUI Team",
Expand Down Expand Up @@ -32,7 +32,7 @@
"repository": {
"type": "git",
"url": "https://github.com/mui/mui-x.git",
"directory": "packages/x-license-pro"
"directory": "packages/x-license"
},
"dependencies": {
"@babel/runtime": "^7.23.9",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
LicenseInfo,
generateLicense,
Unstable_LicenseInfoProvider as LicenseInfoProvider,
} from '@mui/x-license-pro';
} from '@mui/x-license';
import { sharedLicenseStatuses } from './useLicenseVerifier';
import { generateReleaseInfo } from '../verifyLicense';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 3 additions & 6 deletions scripts/sizeSnapshot/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ async function getWebpackEntries() {
path: 'packages/grid/x-data-grid/build/index-esm.js',
},
{
name: '@mui/x-license-pro',
path: 'packages/x-license-pro/build/esm/index.js',
name: '@mui/x-license',
path: 'packages/x-license/build/esm/index.js',
},
];
}
Expand Down Expand Up @@ -74,10 +74,7 @@ module.exports = async function webpackConfig(webpack, environment) {
workspaceRoot,
'packages/grid/x-data-grid-premium/build/index-esm.js',
),
'@mui/x-license-pro': path.join(
workspaceRoot,
'packages/x-license-pro/build/esm/index.js',
),
'@mui/x-license': path.join(workspaceRoot, 'packages/x-license/build/esm/index.js'),
},
},
entry: { [entry.name]: path.join(workspaceRoot, entry.path) },
Expand Down
File renamed without changes.
Loading

0 comments on commit 8394944

Please sign in to comment.