Skip to content

Commit

Permalink
[core] Improve release
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 30, 2024
1 parent 16ff52a commit f408506
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 38 deletions.
4 changes: 2 additions & 2 deletions packages/mui-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-base/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-core-downloads-tracker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf build",
"build": "mkdir build && pnpm build:copy-files",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
},
"homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-docs",
"scripts": {
"prebuild": "rimraf build",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
"build:modern": "echo 'Skip modern build'",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:types": "node ../../scripts/buildTypes.mjs",
"build:copy-files": "node ../../scripts/copyFiles.mjs ./src/translations/translations.json:./translations/translations.json ./src/translations/translations.json:./node/translations/translations.json",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
"test": "exit 0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-icons-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf build",
"build": "shx cp -r lib/ build/ && pnpm build:typings && pnpm build:copy-files",
"build:lib": "pnpm build:node && pnpm build:stable",
"build:lib:clean": "rimraf lib/ && pnpm build:lib",
"build:modern": "echo 'Skip modern build'",
"build:node": "node ../../scripts/build.mjs node --largeFiles --outDir lib",
"build:stable": "node ../../scripts/build.mjs stable --largeFiles --outDir lib",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"build:typings": "node ./scripts/create-typings.mjs",
"prebuild": "rimraf build",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"src:download": "node ./scripts/download.mjs",
"src:icons": "cross-env UV_THREADPOOL_SIZE=64 node ./builder.mjs --output-dir src --svg-dir material-icons --renameFilter ./renameFilters/material-design-icons.mjs && pnpm build:lib:clean",
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-joy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-joy/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json",
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-lab/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-material-nextjs/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material-pigment-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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 styles.css",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-material/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json",
Expand Down
6 changes: 3 additions & 3 deletions packages/mui-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-material/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-private-theming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf build",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && 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",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-private-theming/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-styled-engine-sc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf build",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && 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",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-styled-engine-sc/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-styled-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf build",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && 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",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-styled-engine/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf build",
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && 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",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-styles/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-system/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
},
"homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-types",
"scripts": {
"prebuild": "rimraf build",
"build": "mkdir build && cpy index.d.ts build/ && cpy OverridableComponentAugmentation.ts build/ && pnpm build:copy-files",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
"test": "echo 'No runtime test. Type tests are run with the `typescript` script.'",
"typescript": "tsc -p tsconfig.json"
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"prebuild": "rimraf --glob build \"*.tsbuildinfo\"",
"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",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-utils/**/*.test.?(c|m)[jt]s?(x)'",
"typescript": "tsc -p tsconfig.json"
Expand Down
27 changes: 15 additions & 12 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ A typical release goes like this:

### Prerequisites

1. You must be a member of the `@mui` org in npm to publish the release
2. Set up your npm authToken by logging into npm (`npm login`) . This will save a token to `~/.npmrc` as a line that looks
1. You must be a member of the `@mui` org in npm to publish the release.
2. Set up your npm authToken by logging into npm (`npm login`). This will save a token to `~/.npmrc` as a line that looks

Check warning on line 10 in scripts/README.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": "scripts/README.md", "range": {"start": {"line": 10, "column": 70}}}, "severity": "WARNING"}
like this:
```text
//registry.npmjs.org/:_authToken=npm_000000000000000000000000000000000000
Expand All @@ -18,7 +18,7 @@ A typical release goes like this:
```
4. Generate a GitHub Token at https://github.com/settings/personal-access-tokens/new and add it to your shell rc script (either `.bashrc` or `.zshrc`) as `GITHUB_TOKEN`.

### Prepare
### Prepare the release of the packages

The following steps must be proposed as a pull request.

Expand All @@ -29,19 +29,22 @@ The following steps must be proposed as a pull request.
2. Clean the generated changelog:
1. Match the format of https://github.com/mui/material-ui/releases.
2. Change the packages names casing to be lowercase if applicable
3. Update the root `/package.json`'s version
3. Update the root `/package.json`'s version.
4. Run `pnpm release:version`. Keep the package versions of stable public packages the same as the root `package.json` version.
5. Open PR with changes and wait for review and green CI
6. Merge PR once CI is green and it has been approved
5. Open PR with changes and wait for review and green CI.
6. Merge PR once CI is green and it has been approved.

### Release
### Release the packages

1. Checkout the last version of the release branch
2. `pnpm install && pnpm release:build` (make sure you have the latest dependencies installed, and build the packages)
3. `pnpm release:publish` (release the versions on npm, you need your 2FA device)
4. `pnpm release:tag` (push the newly created tag)
1. Checkout the last version of the release branch.
2. `pnpm install && pnpm release:build` (make sure you have the latest dependencies installed, and build the packages).
3. `pnpm release:publish` (release the versions on npm, you need your 2FA device).
4. `pnpm release:tag` (push the newly created tag).

### Documentation
> Tip: You can use `release:publish:dry-run` to test the release process without actually publishing the packages.
> Be sure install [verdaccio](https://verdaccio.org/) (local npm registry) before doing it.
### Publish the documentation

`pnpm docs:deploy` to deploy the documentation (it lives at https://material-ui.netlify.app/) with the latest changes.
Force push if necessary.
Expand Down
9 changes: 8 additions & 1 deletion scripts/copyFiles.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-console */
import path from 'path';
import { $ } from 'execa';
import {
createModulePackages,
createPackageFile,
Expand All @@ -8,6 +9,8 @@ import {
typescriptCopy,
} from './copyFilesUtils.mjs';

const $$ = $({ stdio: 'inherit' });

const packagePath = process.cwd();
const buildPath = path.join(packagePath, './build');
const srcPath = path.join(packagePath, './src');
Expand Down Expand Up @@ -36,6 +39,10 @@ async function addLicense(packageData) {
);
}

async function removeBuildArtefacts() {
await $$`rimraf --glob ${buildPath}/*.tsbuildinfo`;
}

async function run() {
const extraFiles = process.argv.slice(2);
try {
Expand All @@ -52,7 +59,7 @@ async function run() {
);

await addLicense(packageData);

await removeBuildArtefacts();
await createModulePackages({ from: srcPath, to: buildPath });
} catch (err) {
console.error(err);
Expand Down

0 comments on commit f408506

Please sign in to comment.