Skip to content

Commit

Permalink
[code-infra] Make useReactVersion script reusable in other repos (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed Jul 18, 2024
1 parent 4523ba2 commit 0d9333e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ commands:
description: 'Set to true if you intend to any browser (for example with playwright).'

steps:
- run:
name: Resolve React version
command: |
node scripts/useReactVersion.mjs
# log a patch for maintainers who want to check out this change
git --no-pager diff HEAD
- when:
condition: << parameters.browsers >>
steps:
Expand Down Expand Up @@ -106,6 +99,14 @@ commands:
command: |
node --version
pnpm --version
- run:
name: Resolve React version
command: |
pnpm use-react-version
# log a patch for maintainers who want to check out this change
git --no-pager diff HEAD
- run:
name: Install js dependencies
command: pnpm install
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"test:argos": "node ./scripts/pushArgos.mjs",
"typescript": "lerna run --no-bail --parallel typescript",
"typescript:ci": "lerna run --concurrency 3 --no-bail --no-sort typescript",
"use-react-version": "node ./scripts/useReactVersion.mjs",
"validate-declarations": "tsx scripts/validateTypescriptDeclarations.mts",
"generate-codeowners": "node scripts/generateCodeowners.mjs",
"canary:release": "tsx ./scripts/canaryRelease.mts",
Expand Down
3 changes: 1 addition & 2 deletions scripts/useReactVersion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import { promisify } from 'util';
import { getWorkspaceRoot } from './utils.mjs';

const exec = promisify(childProcess.exec);

Expand All @@ -37,7 +36,7 @@ async function main(version) {
return;
}

const packageJsonPath = path.resolve(getWorkspaceRoot(), 'package.json');
const packageJsonPath = path.resolve(process.cwd(), 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));

// the version is something in format: "17.0.0"
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ For example, in https://app.circleci.com/pipelines/github/mui/material-ui/32796/

### Testing multiple versions of React

You can check integration of different versions of React (for example different [release channels](https://react.dev/community/versioning-policy) or PRs to React) by running `node scripts/useReactVersion.mjs <version>`.
You can check integration of different versions of React (for example different [release channels](https://react.dev/community/versioning-policy) or PRs to React) by running `pnpm use-react-version <version>`.

Possible values for `version`:

Expand Down

0 comments on commit 0d9333e

Please sign in to comment.