Skip to content

Commit

Permalink
[core] Use Lerna to publish (mui#23793)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Dec 3, 2020
1 parent 3faa5a9 commit 6cc38f9
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ jobs:
command: xvfb-run yarn test:regressions
- run:
name: Upload screenshots to Argos CI
command: yarn argos
command: yarn test:argos
workflows:
version: 2
pipeline:
Expand Down
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"packages": ["packages/*", "docs", "framer"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "independent"
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"scripts": {
"proptypes": "cross-env BABEL_ENV=test babel-node --extensions \".tsx,.ts,.js\" ./scripts/generateProptypes.ts",
"deduplicate": "node scripts/deduplicate.js",
"argos": "node ./scripts/pushArgos.js",
"benchmark:browser": "yarn workspace benchmark browser",
"build:release": "lerna run --parallel --scope \"@material-ui/*\" build",
"build:codesandbox": "lerna run --parallel --scope \"@material-ui/*\" build",
"release": "yarn build:release && lerna publish --no-changelog --dist-tag next --contents build",
"publish:dry-run": "lerna publish --no-changelog --dist-tag next --contents build --no-git-tag-version --no-push --registry=\"http://localhost:4873/\"",
"docs:api": "rimraf ./docs/pages/api-docs && yarn docs:api:build",
"docs:api:build": "cross-env BABEL_ENV=test __NEXT_EXPORT_TRAILING_SLASH=true babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/buildApi.ts ./docs/pages/api-docs ./packages/material-ui-unstyled/src ./packages/material-ui/src ./packages/material-ui-lab/src",
"docs:build": "yarn workspace docs build",
Expand Down Expand Up @@ -49,6 +51,7 @@
"test:umd": "node packages/material-ui/test/umd/run.js",
"test:unit": "cross-env NODE_ENV=test mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'",
"test:watch": "yarn test:unit --watch",
"test:argos": "node ./scripts/pushArgos.js",
"typescript": "lerna run --no-bail --parallel typescript"
},
"devDependencies": {
Expand Down
20 changes: 10 additions & 10 deletions packages/material-ui-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The diff should look like this:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v5.0.0/box-sx-prop.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v5.0.0/box-sx-prop.js
```

#### `moved-lab-modules`
Expand All @@ -52,7 +52,7 @@ or
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v5.0.0/moved-lab-modules.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v5.0.0/moved-lab-modules.js
```

#### `textfield-variant-prop`
Expand All @@ -70,7 +70,7 @@ The diff should look like this:
This codemod is non-idempotent (`variant="standard"` would be added on a subsequent run, where `variant="outlined"` was removed), so should only be run once against any particular codebase.

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v5.0.0/textfield-variant-prop.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v5.0.0/textfield-variant-prop.js
```

### v4.0.0
Expand All @@ -86,7 +86,7 @@ The diff should look like this:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v4.0.0/theme-spacing-api.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v4.0.0/theme-spacing-api.js
```

This codemod tries to perform a basic expression simplification which can be improved for expressions that use more than one operation.
Expand All @@ -111,7 +111,7 @@ Converts all `@material-ui/core` imports more than 1 level deep to the optimal f
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v4.0.0/optimal-imports.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v4.0.0/optimal-imports.js
```

Head to https://material-ui.com/guides/minimizing-bundle-size/ to understand when it's useful.
Expand All @@ -127,7 +127,7 @@ Converts all `@material-ui/core` submodule imports to the root module:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v4.0.0/top-level-imports.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v4.0.0/top-level-imports.js
```

Head to https://material-ui.com/guides/minimizing-bundle-size/ to understand when it's useful.
Expand All @@ -146,7 +146,7 @@ The diff should look like this:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v1.0.0/import-path.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v1.0.0/import-path.js
```

**Notice**: if you are migrating from pre-v1.0, and your imports use `material-ui`, you will need to manually find and replace all references to `material-ui` in your code to `@material-ui/core`. E.g.:
Expand All @@ -171,7 +171,7 @@ The diff should look like this:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v1.0.0/color-imports.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v1.0.0/color-imports.js
```

**additional options**
Expand All @@ -193,7 +193,7 @@ The diff should look like this:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v1.0.0/svg-icon-imports.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v1.0.0/svg-icon-imports.js
```

### v0.15.0
Expand All @@ -215,7 +215,7 @@ The diff should look like this:
```

```sh
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/lib/v0.15.0/import-path.js
find src -name '*.js' -print | xargs npx jscodeshift -t node_modules/@material-ui/codemod/v0.15.0/import-path.js
```

### Recast Options
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
],
"scripts": {
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/material-ui-codemod/**/*.test.js'",
"prebuild": "rimraf lib",
"build": "node ../../scripts/build node --out-dir ./lib",
"prebuild": "rimraf build",
"build": "node ../../scripts/build node --out-dir ./build && cp README.md build && cp package.json build",
"release": "yarn build && npm publish --tag next"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
},
"dependencies": {
"@babel/runtime": "^7.4.4",
"@material-ui/system": "^5.0.0-alpha.18",
"@material-ui/utils": "^5.0.0-alpha.18",
"@material-ui/system": "5.0.0-alpha.18",
"@material-ui/utils": "5.0.0-alpha.18",
"clsx": "^1.0.4",
"prop-types": "^15.7.2",
"react-is": "^16.8.0 || ^17.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@babel/runtime": "^7.4.4",
"@emotion/hash": "^0.8.0",
"@material-ui/types": "^5.1.0",
"@material-ui/utils": "^5.0.0-alpha.18",
"@material-ui/utils": "5.0.0-alpha.18",
"clsx": "^1.0.4",
"csstype": "^3.0.2",
"hoist-non-react-statics": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"dependencies": {
"@babel/runtime": "^7.4.4",
"@material-ui/utils": "^5.0.0-alpha.18",
"@material-ui/utils": "5.0.0-alpha.18",
"prop-types": "^15.7.2",
"csstype": "^3.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-unstyled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@babel/runtime": "^7.4.4",
"@material-ui/utils": "^5.0.0-alpha.18",
"@material-ui/utils": "5.0.0-alpha.18",
"clsx": "^1.0.4",
"prop-types": "^15.7.2",
"react-is": "^16.8.0 || ^17.0.0"
Expand Down
12 changes: 6 additions & 6 deletions packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
},
"dependencies": {
"@babel/runtime": "^7.4.4",
"@material-ui/styled-engine": "^5.0.0-alpha.18",
"@material-ui/styles": "^5.0.0-alpha.18",
"@material-ui/system": "^5.0.0-alpha.18",
"@material-ui/types": "^5.1.0",
"@material-ui/unstyled": "^5.0.0-alpha.18",
"@material-ui/utils": "^5.0.0-alpha.18",
"@material-ui/styled-engine": "5.0.0-alpha.18",
"@material-ui/styles": "5.0.0-alpha.18",
"@material-ui/system": "5.0.0-alpha.18",
"@material-ui/types": "5.1.0",
"@material-ui/unstyled": "5.0.0-alpha.18",
"@material-ui/utils": "5.0.0-alpha.18",
"@popperjs/core": "^2.4.4",
"@types/react-transition-group": "^4.2.0",
"clsx": "^1.0.4",
Expand Down
38 changes: 38 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Material-UI Scripts

## Release

A typical release goes like this:

1. **Changelog**. Generate the changelog:

- Compare the last version with `next`. For instance: https://github.com/mui-org/material-ui/compare/v5.0.0-alpha.17...next
- Generate the changelog with this script: https://trello.com/c/uspnIWkh/1566-release-note
- Clean the generated changelog, to match the format of https://github.com/mui-org/material-ui/releases.
- Open a pull request with the generated change on `next`.

1. **npm**. Release the packages to npm. You need your 2FA device:

```
git checkout next
git pull
yarn
yarn release
```

1. **git**. Push the release git commit and git tag to master (e.g. "v5.0.0-alpha.17"):

```
git push
git push --tag
```

1. **Docs**. Push the next branch on the material-ui-docs repository to deploy the documentation with the latest changes. It lives at https://material-ui.netlify.app/. Force push if necessary.

```
yarn docs:deploy
```

1. **GitHub**. Make a new release on GitHub (for people subscribing to updates). https://github.com/mui-org/material-ui/releases

2. **Twitter**. Make sure Material-UI X was released too: https://trello.com/c/kYF9OLLi/105-release-steps. Send a tweet with the main Twitter account to summarize what happened.

0 comments on commit 6cc38f9

Please sign in to comment.