From ce1be309fa0e35bee087fe3bbbd6f99776e2f82b Mon Sep 17 00:00:00 2001 From: angelabenavente Date: Mon, 31 Aug 2026 23:08:12 +0200 Subject: [PATCH] fix(docs): add patch to CLI --version --- docs/the-new-architecture/pure-cxx-modules.md | 2 +- docs/the-new-architecture/using-codegen.mdx | 2 +- docs/turbo-native-modules.md | 2 +- website/src/getCurrentVersion.ts | 7 ++++++- .../version-0.87/the-new-architecture/pure-cxx-modules.md | 2 +- .../version-0.87/the-new-architecture/using-codegen.mdx | 2 +- .../versioned_docs/version-0.87/turbo-native-modules.md | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/the-new-architecture/pure-cxx-modules.md b/docs/the-new-architecture/pure-cxx-modules.md index 06a11572201..083bd8f7a42 100644 --- a/docs/the-new-architecture/pure-cxx-modules.md +++ b/docs/the-new-architecture/pure-cxx-modules.md @@ -19,7 +19,7 @@ In this guide, we will go through the creation of a pure C++ Turbo Native Module The rest of this guide assumes that you have created your application running the command: -{`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`} +{`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`} ## 1. Create the JS specs diff --git a/docs/the-new-architecture/using-codegen.mdx b/docs/the-new-architecture/using-codegen.mdx index 49df503003f..adac9313115 100644 --- a/docs/the-new-architecture/using-codegen.mdx +++ b/docs/the-new-architecture/using-codegen.mdx @@ -19,7 +19,7 @@ The **Codegen** process is tightly coupled with the build of the app, and the sc For the sake of this guide, create a project using the React Native CLI as follows: - {`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`} + {`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`} **Codegen** is used to generate the glue-code for your custom modules or components. See the guides for Turbo Native Modules and Fabric Native Components for more details on how to create them. diff --git a/docs/turbo-native-modules.md b/docs/turbo-native-modules.md index 4d97e5bbb7a..252a21ffd65 100644 --- a/docs/turbo-native-modules.md +++ b/docs/turbo-native-modules.md @@ -24,7 +24,7 @@ The basic steps are: Lets work through each of these steps by building an example Turbo Native Module. The rest of this guide assume that you have created your application running the command: -{`npx @react-native-community/cli@latest init TurboModuleExample --version ${getCurrentVersion()}`} +{`npx @react-native-community/cli@latest init TurboModuleExample --version "${getCurrentVersion()}"`} ## Native Persistent Storage diff --git a/website/src/getCurrentVersion.ts b/website/src/getCurrentVersion.ts index 24c5e787064..0afa1b0c177 100644 --- a/website/src/getCurrentVersion.ts +++ b/website/src/getCurrentVersion.ts @@ -2,5 +2,10 @@ import {useActiveVersion} from '@docusaurus/plugin-content-docs/client'; export function getCurrentVersion() { const version = useActiveVersion(undefined); - return version.label === 'Next' ? 'latest' : version.label; + if (!version || version.label === 'Next') { + return 'latest'; + } + return /^\d+\.\d+$/.test(version.label) + ? `${version.label}.0` + : version.label; } diff --git a/website/versioned_docs/version-0.87/the-new-architecture/pure-cxx-modules.md b/website/versioned_docs/version-0.87/the-new-architecture/pure-cxx-modules.md index 06a11572201..083bd8f7a42 100644 --- a/website/versioned_docs/version-0.87/the-new-architecture/pure-cxx-modules.md +++ b/website/versioned_docs/version-0.87/the-new-architecture/pure-cxx-modules.md @@ -19,7 +19,7 @@ In this guide, we will go through the creation of a pure C++ Turbo Native Module The rest of this guide assumes that you have created your application running the command: -{`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`} +{`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`} ## 1. Create the JS specs diff --git a/website/versioned_docs/version-0.87/the-new-architecture/using-codegen.mdx b/website/versioned_docs/version-0.87/the-new-architecture/using-codegen.mdx index 49df503003f..adac9313115 100644 --- a/website/versioned_docs/version-0.87/the-new-architecture/using-codegen.mdx +++ b/website/versioned_docs/version-0.87/the-new-architecture/using-codegen.mdx @@ -19,7 +19,7 @@ The **Codegen** process is tightly coupled with the build of the app, and the sc For the sake of this guide, create a project using the React Native CLI as follows: - {`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`} + {`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`} **Codegen** is used to generate the glue-code for your custom modules or components. See the guides for Turbo Native Modules and Fabric Native Components for more details on how to create them. diff --git a/website/versioned_docs/version-0.87/turbo-native-modules.md b/website/versioned_docs/version-0.87/turbo-native-modules.md index 4d97e5bbb7a..252a21ffd65 100644 --- a/website/versioned_docs/version-0.87/turbo-native-modules.md +++ b/website/versioned_docs/version-0.87/turbo-native-modules.md @@ -24,7 +24,7 @@ The basic steps are: Lets work through each of these steps by building an example Turbo Native Module. The rest of this guide assume that you have created your application running the command: -{`npx @react-native-community/cli@latest init TurboModuleExample --version ${getCurrentVersion()}`} +{`npx @react-native-community/cli@latest init TurboModuleExample --version "${getCurrentVersion()}"`} ## Native Persistent Storage