Skip to content

Commit 7486a2b

Browse files
huntiemeta-codesync[bot]
authored andcommitted
Fix set-version script to update rn-tester (#54451)
Summary: Pull Request resolved: #54451 Restores behaviour pre-D76358273. `rn-tester` is a special case package that we do want to version, even though it's marked as `private: true`. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D86534510 fbshipit-source-id: 5557e22361bba82a6acaa5eab911002bb9894ae4
1 parent 84ee4d4 commit 7486a2b

2 files changed

Lines changed: 27 additions & 16 deletions

File tree

scripts/releases/set-version.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,16 @@ async function setVersion(
7272
skipReactNativeVersion /*: boolean */ = false,
7373
) /*: Promise<void> */ {
7474
const packages = await getPackages({
75-
includePrivate: true,
7675
includeReactNative: true,
76+
forceIncludeRNTester: true,
7777
});
7878
const newPackageVersions = Object.fromEntries(
79-
Object.entries(packages).map(([packageName, {packageJson}]) => {
80-
let packageVersion = version;
81-
if (packageName === 'react-native' && skipReactNativeVersion) {
82-
packageVersion = '1000.0.0';
83-
} else if (packageJson.private === true) {
84-
packageVersion = packageJson.version ?? '0.0.0';
85-
}
86-
return [packageName, packageVersion];
87-
}),
79+
Object.keys(packages).map(packageName => [
80+
packageName,
81+
packageName === 'react-native' && skipReactNativeVersion
82+
? '1000.0.0'
83+
: version,
84+
]),
8885
);
8986

9087
const packagesToUpdate = [

scripts/shared/monorepoUtils.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ export type PackageJson = {
2727
};
2828
2929
type PackagesFilter = $ReadOnly<{
30+
// Include the main react-native package
3031
includeReactNative: boolean,
32+
33+
// Include packages marked with `private: true`
3134
includePrivate?: boolean,
35+
36+
// Force include the rn-tester package. Special case of a private package
37+
// that we version and depend on in fbsource.
38+
forceIncludeRNTester?: boolean,
3239
}>;
3340
3441
export type PackageInfo = {
@@ -48,13 +55,17 @@ export type ProjectInfo = {
4855
*/
4956

5057
/**
51-
* Locates monrepo packages and returns a mapping of package names to their
52-
* metadata. Considers Yarn workspaces under `packages/`.
58+
* Locates monorepo packages and returns a mapping of package names to their
59+
* metadata. Considers Yarn workspaces under `packages/` and `private/`.
5360
*/
5461
async function getPackages(
5562
filter /*: PackagesFilter */,
5663
) /*: Promise<ProjectInfo> */ {
57-
const {includeReactNative, includePrivate = false} = filter;
64+
const {
65+
includeReactNative,
66+
includePrivate = false,
67+
forceIncludeRNTester = false,
68+
} = filter;
5869

5970
const packagesEntries = await Promise.all(
6071
glob
@@ -69,9 +80,12 @@ async function getPackages(
6980
);
7081

7182
return Object.fromEntries(
72-
packagesEntries.filter(
73-
([_, {packageJson}]) => packageJson.private !== true || includePrivate,
74-
),
83+
packagesEntries.filter(([_, {name, packageJson}]) => {
84+
if (name === '@react-native/tester') {
85+
return forceIncludeRNTester;
86+
}
87+
return packageJson.private !== true || includePrivate;
88+
}),
7589
);
7690
}
7791

0 commit comments

Comments
 (0)