Skip to content

Commit ce1be30

Browse files
fix(docs): add patch to CLI --version
1 parent a1bba0d commit ce1be30

7 files changed

Lines changed: 12 additions & 7 deletions

File tree

docs/the-new-architecture/pure-cxx-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In this guide, we will go through the creation of a pure C++ Turbo Native Module
1919
The rest of this guide assumes that you have created your application running the command:
2020

2121
<CodeBlock language="bash" title="shell">
22-
{`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`}
22+
{`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`}
2323
</CodeBlock>
2424

2525
## 1. Create the JS specs

docs/the-new-architecture/using-codegen.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The **Codegen** process is tightly coupled with the build of the app, and the sc
1919
For the sake of this guide, create a project using the React Native CLI as follows:
2020

2121
<CodeBlock language="bash" title="shell">
22-
{`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`}
22+
{`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`}
2323
</CodeBlock>
2424

2525
**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.

docs/turbo-native-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The basic steps are:
2424
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:
2525

2626
<CodeBlock language="bash" title="shell">
27-
{`npx @react-native-community/cli@latest init TurboModuleExample --version ${getCurrentVersion()}`}
27+
{`npx @react-native-community/cli@latest init TurboModuleExample --version "${getCurrentVersion()}"`}
2828
</CodeBlock>
2929

3030
## Native Persistent Storage

website/src/getCurrentVersion.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@ import {useActiveVersion} from '@docusaurus/plugin-content-docs/client';
22

33
export function getCurrentVersion() {
44
const version = useActiveVersion(undefined);
5-
return version.label === 'Next' ? 'latest' : version.label;
5+
if (!version || version.label === 'Next') {
6+
return 'latest';
7+
}
8+
return /^\d+\.\d+$/.test(version.label)
9+
? `${version.label}.0`
10+
: version.label;
611
}

website/versioned_docs/version-0.87/the-new-architecture/pure-cxx-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In this guide, we will go through the creation of a pure C++ Turbo Native Module
1919
The rest of this guide assumes that you have created your application running the command:
2020

2121
<CodeBlock language="bash" title="shell">
22-
{`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`}
22+
{`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`}
2323
</CodeBlock>
2424

2525
## 1. Create the JS specs

website/versioned_docs/version-0.87/the-new-architecture/using-codegen.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The **Codegen** process is tightly coupled with the build of the app, and the sc
1919
For the sake of this guide, create a project using the React Native CLI as follows:
2020

2121
<CodeBlock language="bash" title="shell">
22-
{`npx @react-native-community/cli@latest init SampleApp --version ${getCurrentVersion()}`}
22+
{`npx @react-native-community/cli@latest init SampleApp --version "${getCurrentVersion()}"`}
2323
</CodeBlock>
2424

2525
**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.

website/versioned_docs/version-0.87/turbo-native-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The basic steps are:
2424
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:
2525

2626
<CodeBlock language="bash" title="shell">
27-
{`npx @react-native-community/cli@latest init TurboModuleExample --version ${getCurrentVersion()}`}
27+
{`npx @react-native-community/cli@latest init TurboModuleExample --version "${getCurrentVersion()}"`}
2828
</CodeBlock>
2929

3030
## Native Persistent Storage

0 commit comments

Comments
 (0)