Skip to content

Commit e126fd8

Browse files
authored
docs: add helper for creating versioned core repo links (#4910)
1 parent c719226 commit e126fd8

File tree

8 files changed

+20
-7
lines changed

8 files changed

+20
-7
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34

@@ -228,7 +229,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
228229
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
229230

230231
<CodeBlock language="sh" title="shell">
231-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
232+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
232233
</CodeBlock>
233234

234235
2. Then, modify this file as follows:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import {useActiveVersion} from '@docusaurus/plugin-content-docs/client';
2+
3+
export function getCoreBranchNameForCurrentVersion() {
4+
const version = useActiveVersion(undefined);
5+
return version.label === 'Next' ? 'main' : `v${version.label}.0`;
6+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
@@ -227,7 +228,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
227228
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
228229

229230
<CodeBlock language="sh" title="shell">
230-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231232
</CodeBlock>
232233

233234
2. Then, modify this file as follows:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
@@ -227,7 +228,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
227228
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
228229

229230
<CodeBlock language="sh" title="shell">
230-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231232
</CodeBlock>
232233

233234
2. Then, modify this file as follows:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
@@ -227,7 +228,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
227228
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
228229

229230
<CodeBlock language="sh" title="shell">
230-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231232
</CodeBlock>
232233

233234
2. Then, modify this file as follows:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
@@ -227,7 +228,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
227228
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
228229

229230
<CodeBlock language="sh" title="shell">
230-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231232
</CodeBlock>
232233

233234
2. Then, modify this file as follows:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
@@ -227,7 +228,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
227228
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
228229

229230
<CodeBlock language="sh" title="shell">
230-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231232
</CodeBlock>
232233

233234
2. Then, modify this file as follows:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {getCoreBranchNameForCurrentVersion} from '@site/src/getCoreBranchNameForCurrentVersion';
12
import {getCurrentVersion} from '@site/src/getCurrentVersion';
23
import CodeBlock from '@theme/CodeBlock';
34
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
@@ -227,7 +228,7 @@ The final step is to register the new C++ Turbo Native Module in the runtime, so
227228
1. From the folder `SampleApp/android/app/src/main/jni`, run the following command:
228229

229230
<CodeBlock language="sh" title="shell">
230-
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCurrentVersion() === 'latest' ? '' : 'v'}${getCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231+
{`curl -O https://raw.githubusercontent.com/facebook/react-native/${getCoreBranchNameForCurrentVersion()}/packages/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp`}
231232
</CodeBlock>
232233

233234
2. Then, modify this file as follows:

0 commit comments

Comments
 (0)