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

[core] Remove tsconfig.json.tsbuildinfo from npm #1245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "rimraf ./export && cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=8192 next build --profile",
"build:clean": "rimraf .next && pnpm build",
"dev": "next dev --port 3005",
"deploy": "git push -f material-ui-docs master:latest",
"deploy": "git push -f upstream master:docs-v1",
"serve": "serve ./export -l 3010",
"typescript": "tsc -b tsconfig.json",
"link-check": "tsx ./scripts/reportBrokenLinks.mts"
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
},
"type": "commonjs",
"scripts": {
"prebuild": "rimraf --glob build build-tests \"*.tsbuildinfo\"",
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files && pnpm build:manifest",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:types": "tsx ../../scripts/buildTypes.mts --project tsconfig.build.json --copy build/cjs",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"build:types": "tsx ../../scripts/buildTypes.mjs --project tsconfig.build.json --copy build/cjs",
Copy link
Member Author

@oliviertassinari oliviertassinari Dec 30, 2024

Choose a reason for hiding this comment

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

The file extension was wrong buildTypes.mjs -> buildTypes.mts. I'm amazed it still worked.

"build:manifest": "tsx ./scripts/createPackageManifest.mts",
"test:package": "publint ./build && attw --pack ./build",
"prebuild": "rimraf --glob build build-tests \"*.tsbuildinfo\"",
Comment on lines +66 to -73
Copy link
Member Author

Choose a reason for hiding this comment

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

Logical order

"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/react/**/*.test.{js,ts,tsx}'",
"typescript": "tsc -b tsconfig.json"
Expand Down
40 changes: 19 additions & 21 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@

### 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 `@base-ui-components` 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
```
3. Make sure you have added the `material-ui-docs` remote to deploy the documentation:
```bash
git remote add material-ui-docs https://github.com/mui/material-ui-docs.git
```
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`.
3. 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 @@ -28,33 +24,35 @@

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, for example change `Material` to `material`
3. Update the root `/package.json`'s version
2. Change the packages names casing to be lowercase if applicable
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 the packages

### Release
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)
> 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.
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
> Be sure install [verdaccio](https://verdaccio.org/) (local npm registry) before doing it.
> Make sure to have [verdaccio](https://verdaccio.org/) (local npm registry) installed before doing it.


### Publish the documentation

The documentation must be updated on the `docs-vX` branch (`docs-v1` for `v1.X` releases, `docs-v2` for `v2.X` releases, etc.)

Push the working branch to the documentation release branch to deploy the documentation with the latest changes.
Push the working branch to the documentation release branch to deploy the documentation with the latest changes:

<!-- #default-branch-switch -->

```bash
git push -f upstream master:docs-v1
pnpm docs:deploy
Copy link
Member Author

Choose a reason for hiding this comment

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

Makes this resilient to docs versioning. We struggled a bit with this on X.

Copy link
Member

Choose a reason for hiding this comment

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

There's no need for the default-branch-switch comment anymore after this change

```

You can follow the deployment process [on the Netlify Dashboard](https://app.netlify.com/sites/material-ui-x/deploys?filter=docs-next)
Once deployed, it will be accessible at https://material-ui-x.netlify.app/ for the `docs-next` deployment.
You can follow the deployment process [on the Netlify Dashboard](https://app.netlify.com/sites/base-ui/deploys).

### Announce

Expand Down
14 changes: 12 additions & 2 deletions scripts/copyFiles.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* eslint-disable no-console */
import path from 'path';
import fse from 'fs-extra';
Copy link
Member Author

Choose a reason for hiding this comment

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

No reason to use fs-extra anymore, we should remove it from the codebase.

import fs from 'fs/promises';
import { $ } from 'execa';
import { includeFileInBuild, prepend, 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 @@ -31,6 +34,10 @@ async function addLicense(packageData) {
);
}

async function removeBuildArtefacts() {
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
async function removeBuildArtefacts() {
async function removeBuildArtifacts() {

We tend to use American spelling throughout the codebase (https://grammarist.com/spelling/artefact-artifact/)

await $$`rimraf --glob ${buildPath}/*.tsbuildinfo`;
Copy link
Member

Choose a reason for hiding this comment

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

Why not use rimraf directly from the script?

}

async function run() {
const extraFiles = process.argv.slice(2);
try {
Expand All @@ -44,9 +51,12 @@ async function run() {
}),
);

const packageFile = await fse.readFile(path.resolve(packagePath, './package.json'), 'utf8');
const packageFile = await fs.readFile(path.resolve(packagePath, './package.json'), {
encoding: 'utf-8',
});
const packageData = JSON.parse(packageFile);
await addLicense(packageData);
await removeBuildArtefacts();
} catch (err) {
console.error(err);
process.exit(1);
Expand Down
Loading