Skip to content

Commit a011830

Browse files
authored
chore: use rspress preset & upgrade to newest rspress beta (#1291)
1 parent 1e6cd16 commit a011830

File tree

20 files changed

+587
-1203
lines changed

20 files changed

+587
-1203
lines changed

pnpm-lock.yaml

Lines changed: 510 additions & 1066 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@
1313
"diff:v3-v4:mjs": "git diff @callstack/[email protected]:templates/webpack.config.mjs HEAD:templates/webpack.config.mjs > src/public/diffs/repack_v3-v4_mjs.diff"
1414
},
1515
"dependencies": {
16-
"@callstack/rspress-theme": "^0.3.1",
17-
"@rspress/plugin-llms": "2.0.0-beta.21",
18-
"rsbuild-plugin-open-graph": "^1.0.2",
19-
"rspress": "2.0.0-beta.21",
20-
"rspress-plugin-sitemap": "^1.1.1",
21-
"rspress-plugin-vercel-analytics": "^0.3.0"
16+
"@callstack/rspress-preset": "^0.4.1",
17+
"@callstack/rspress-theme": "^0.4.1",
18+
"@rspress/core": "2.0.0-beta.32"
2219
},
2320
"devDependencies": {
2421
"@types/node": "catalog:",

website/rspress.config.ts

Lines changed: 51 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,65 @@
11
import * as path from 'node:path';
2-
import { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';
3-
import { pluginLlms } from '@rspress/plugin-llms';
4-
import { pluginOpenGraph } from 'rsbuild-plugin-open-graph';
5-
import pluginSitemap from 'rspress-plugin-sitemap';
6-
import vercelAnalytics from 'rspress-plugin-vercel-analytics';
7-
import { defineConfig } from 'rspress/config';
2+
import { withCallstackPreset } from '@callstack/rspress-preset';
83

94
const LATEST_VERSION = 'v5';
105

116
const DOCS_ROOT = path.join('src', process.env.REPACK_DOC_VERSION ?? 'latest');
127
const EDIT_ROOT_URL = `https://github.com/callstack/repack/tree/main/website/${DOCS_ROOT}`;
138

14-
export default defineConfig({
15-
root: path.join(__dirname, DOCS_ROOT),
16-
outDir: 'build',
17-
title: process.env.REPACK_DOC_VERSION
18-
? `[${process.env.REPACK_DOC_VERSION}] Re.Pack`
19-
: 'Re.Pack',
20-
description:
21-
'A modern build tool for React Native that brings the Rspack and webpack ecosystem to mobile React Native apps',
22-
icon: '/img/favicon.ico',
23-
logo: {
24-
light: '/img/logo-light.png',
25-
dark: '/img/logo-dark.png',
26-
},
27-
markdown: {
28-
checkDeadLinks: true,
29-
},
30-
route: {
31-
cleanUrls: true,
32-
},
33-
search: {
34-
versioned: true,
35-
codeBlocks: true,
36-
},
37-
themeConfig: {
38-
enableContentAnimation: true,
39-
enableScrollToTop: true,
40-
outlineTitle: 'Contents',
41-
footer: {
42-
message: `Copyright © ${new Date().getFullYear()} Callstack Open Source`,
43-
},
44-
editLink: {
45-
docRepoBaseUrl: EDIT_ROOT_URL,
46-
text: 'Edit this page on GitHub',
47-
},
48-
socialLinks: [
49-
{
50-
icon: 'github',
51-
mode: 'link',
52-
content: 'https://github.com/callstack/repack',
53-
},
54-
{
55-
icon: 'X',
56-
mode: 'link',
57-
content: 'https://x.com/repack_rn',
9+
export default withCallstackPreset(
10+
{
11+
context: __dirname,
12+
docs: {
13+
description:
14+
'A modern build tool for React Native that brings the Rspack and webpack ecosystem to mobile React Native apps',
15+
editUrl: EDIT_ROOT_URL,
16+
icon: '/img/favicon.ico',
17+
logoDark: '/img/logo-dark.png',
18+
logoLight: '/img/logo-light.png',
19+
ogImage: '/img/og-image.jpg',
20+
rootDir: DOCS_ROOT,
21+
rootUrl: 'https://re-pack.dev',
22+
socials: {
23+
github: 'https://github.com/callstack/repack',
24+
x: 'https://x.com/repack_rn',
25+
discord: 'https://discord.gg/TWDBep3nXV',
5826
},
59-
{
60-
icon: 'discord',
61-
mode: 'link',
62-
content: 'https://discord.gg/TWDBep3nXV',
63-
},
64-
],
27+
title: process.env.REPACK_DOC_VERSION
28+
? `[${process.env.REPACK_DOC_VERSION}] Re.Pack`
29+
: 'Re.Pack',
30+
},
6531
},
66-
builderConfig: {
67-
source: {
68-
define: {
69-
'global.__REPACK_DOC_VERSION__': JSON.stringify(
70-
process.env.REPACK_DOC_VERSION
71-
),
72-
'global.__REPACK_DOC_LATEST_VERSION__': JSON.stringify(LATEST_VERSION),
73-
},
32+
{
33+
outDir: 'build',
34+
globalStyles:
35+
process.env.REPACK_DOC_VERSION !== 'v2' &&
36+
process.env.REPACK_DOC_VERSION !== 'v3' &&
37+
process.env.REPACK_DOC_VERSION !== 'v4'
38+
? path.join(__dirname, 'theme', 'styles.css')
39+
: undefined,
40+
themeConfig: {
41+
enableScrollToTop: true,
7442
},
75-
output: {
76-
distPath: {
77-
// set explicitly for sitemap plugin
78-
root: 'build',
43+
builderConfig: {
44+
source: {
45+
define: {
46+
'global.__REPACK_DOC_VERSION__': JSON.stringify(
47+
process.env.REPACK_DOC_VERSION
48+
),
49+
'global.__REPACK_DOC_LATEST_VERSION__':
50+
JSON.stringify(LATEST_VERSION),
51+
},
7952
},
80-
},
81-
plugins: [
82-
pluginOpenGraph({
83-
title: 'Re.Pack',
84-
type: 'website',
85-
url: 'https://re-pack.dev',
86-
image: 'https://re-pack.dev/img/og-image.jpg',
87-
description: 'A modern build tool for React Native',
88-
twitter: {
89-
site: '@repack_rn',
90-
card: 'summary_large_image',
53+
tools: {
54+
rspack(_config, { addRules }) {
55+
addRules([
56+
{
57+
resourceQuery: /raw/,
58+
type: 'asset/source',
59+
},
60+
]);
9161
},
92-
}),
93-
],
94-
tools: {
95-
rspack(_config, { addRules }) {
96-
addRules([
97-
{
98-
resourceQuery: /raw/,
99-
type: 'asset/source',
100-
},
101-
]);
10262
},
10363
},
104-
},
105-
globalStyles:
106-
process.env.REPACK_DOC_VERSION !== 'v2' &&
107-
process.env.REPACK_DOC_VERSION !== 'v3' &&
108-
process.env.REPACK_DOC_VERSION !== 'v4'
109-
? path.join(__dirname, 'theme', 'styles.css')
110-
: undefined,
111-
plugins: [
112-
// @ts-ignore
113-
pluginSitemap({
114-
domain: 'https://re-pack.dev',
115-
}),
116-
// @ts-ignore
117-
vercelAnalytics(),
118-
// @ts-ignore
119-
pluginCallstackTheme(),
120-
pluginLlms({
121-
exclude: ({ page }) => {
122-
return page.routePath.includes('404');
123-
},
124-
}),
125-
],
126-
});
64+
}
65+
);

website/src/latest/api/cli/bundle.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
In the root of an existing project, run this command in your terminal of choice:
88

9-
import { PackageManagerTabs } from 'rspress/theme';
9+
import { PackageManagerTabs } from '@theme';
1010

1111
<PackageManagerTabs command={{
1212
npm: 'npm run react-native bundle',

website/src/latest/api/cli/start.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
In the root of an existing React Native project with Re.Pack, run this command in your terminal of choice:
88

9-
import { PackageManagerTabs } from 'rspress/theme';
9+
import { PackageManagerTabs } from '@theme';
1010

1111
<PackageManagerTabs command={{
1212
npm: "npm run react-native start",

website/src/latest/api/plugins/module-federation-v2.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The plugin extends the standard Module Federation 2.0 plugin with functionality
2626

2727
First, install the official `@module-federation/enhanced` package which is required by Re.Pack:
2828

29-
import { PackageManagerTabs } from 'rspress/theme';
29+
import { PackageManagerTabs } from '@theme';
3030

3131
<PackageManagerTabs command="install @module-federation/enhanced" />
3232

website/src/latest/docs/features/dev-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For complete DevServer configuration options and API reference, check out the [D
2121

2222
To start the dev server, you can use the following command:
2323

24-
import { PackageManagerTabs } from 'rspress/theme';
24+
import { PackageManagerTabs } from '@theme';
2525

2626
<PackageManagerTabs command={{
2727
npm: "npm run react-native start",

website/src/latest/docs/features/nativewind.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PackageManagerTabs } from 'rspress/theme';
1+
import { PackageManagerTabs } from '@theme';
22

33
# NativeWind
44

website/src/latest/docs/features/reanimated.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PackageManagerTabs } from 'rspress/theme';
1+
import { PackageManagerTabs } from '@theme';
22

33
# React Native Reanimated
44

website/src/latest/docs/getting-started/quick-start.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PackageManagerTabs, Steps, Tabs, Tab } from 'rspress/theme';
1+
import { PackageManagerTabs, Steps, Tabs, Tab } from '@theme';
22

33
# Quick start
44

0 commit comments

Comments
 (0)