Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ module.exports = function getBabelConfig(api) {
'MUI_MAJOR_VERSION',
'MUI_MINOR_VERSION',
'MUI_PATCH_VERSION',
'MUI_PRERELEASE_LABEL',
'MUI_PRERELEASE_NUMBER',
'MUI_PRERELEASE',
],
},
],
Expand Down
11 changes: 3 additions & 8 deletions packages/mui-material/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
import { expect } from 'chai';
import * as MaterialUI from './index';

const versionExports = [
'version',
'major',
'minor',
'patch',
'preReleaseLabel',
'preReleaseNumber',
];
// To skip them in the undefined exports test
// These are checked in the build process (scripts/build.mjs)
const versionExports = ['version', 'major', 'minor', 'patch', 'prerelease'];

describe('material-ui', () => {
it('should have exports', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/mui-material/src/version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const version = process.env.MUI_VERSION;
export const major = Number(process.env.MUI_MAJOR_VERSION);
export const minor = Number(process.env.MUI_MINOR_VERSION);
export const patch = Number(process.env.MUI_PATCH_VERSION);
export const preReleaseLabel = process.env.MUI_PRERELEASE_LABEL || null;
export const preReleaseNumber = Number(process.env.MUI_PRERELEASE_NUMBER) || null;
export const prerelease = process.env.MUI_PRERELEASE;

export default version;
3 changes: 1 addition & 2 deletions packages/mui-system/src/version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const version = process.env.MUI_VERSION;
export const major = Number(process.env.MUI_MAJOR_VERSION);
export const minor = Number(process.env.MUI_MINOR_VERSION);
export const patch = Number(process.env.MUI_PATCH_VERSION);
export const preReleaseLabel = process.env.MUI_PRERELEASE_LABEL || null;
export const preReleaseNumber = Number(process.env.MUI_PRERELEASE_NUMBER) || null;
export const prerelease = process.env.MUI_PRERELEASE;

export default version;
6 changes: 2 additions & 4 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ export async function getVersionEnvVariables() {
throw new Error('Could not find the version in the package.json');
}

const [versionNumber, preReleaseInfo] = version.split('-');
const [versionNumber, prerelease] = version.split('-');
const [major, minor, patch] = versionNumber.split('.');
const [preReleaseLabel, preReleaseNumber] = preReleaseInfo ? preReleaseInfo.split('.') : [];

if (!major || !minor || !patch) {
throw new Error(`Couldn't parse version from package.json`);
Expand All @@ -36,7 +35,6 @@ export async function getVersionEnvVariables() {
MUI_MAJOR_VERSION: major,
MUI_MINOR_VERSION: minor,
MUI_PATCH_VERSION: patch,
MUI_PRERELEASE_LABEL: preReleaseLabel,
MUI_PRERELEASE_NUMBER: preReleaseNumber,
MUI_PRERELEASE: prerelease,
};
}