mirror of
https://github.com/react/react-native.git
synced 2026-09-28 05:13:06 +08:00
Fix set-version script to update rn-tester (#54451)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
committed by
meta-codesync[bot]
parent
84ee4d4643
commit
7486a2bc50
@@ -27,8 +27,15 @@ export type PackageJson = {
|
||||
};
|
||||
|
||||
type PackagesFilter = $ReadOnly<{
|
||||
// Include the main react-native package
|
||||
includeReactNative: boolean,
|
||||
|
||||
// Include packages marked with `private: true`
|
||||
includePrivate?: boolean,
|
||||
|
||||
// Force include the rn-tester package. Special case of a private package
|
||||
// that we version and depend on in fbsource.
|
||||
forceIncludeRNTester?: boolean,
|
||||
}>;
|
||||
|
||||
export type PackageInfo = {
|
||||
@@ -48,13 +55,17 @@ export type ProjectInfo = {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Locates monrepo packages and returns a mapping of package names to their
|
||||
* metadata. Considers Yarn workspaces under `packages/`.
|
||||
* Locates monorepo packages and returns a mapping of package names to their
|
||||
* metadata. Considers Yarn workspaces under `packages/` and `private/`.
|
||||
*/
|
||||
async function getPackages(
|
||||
filter /*: PackagesFilter */,
|
||||
) /*: Promise<ProjectInfo> */ {
|
||||
const {includeReactNative, includePrivate = false} = filter;
|
||||
const {
|
||||
includeReactNative,
|
||||
includePrivate = false,
|
||||
forceIncludeRNTester = false,
|
||||
} = filter;
|
||||
|
||||
const packagesEntries = await Promise.all(
|
||||
glob
|
||||
@@ -69,9 +80,12 @@ async function getPackages(
|
||||
);
|
||||
|
||||
return Object.fromEntries(
|
||||
packagesEntries.filter(
|
||||
([_, {packageJson}]) => packageJson.private !== true || includePrivate,
|
||||
),
|
||||
packagesEntries.filter(([_, {name, packageJson}]) => {
|
||||
if (name === '@react-native/tester') {
|
||||
return forceIncludeRNTester;
|
||||
}
|
||||
return packageJson.private !== true || includePrivate;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user