Skip to content

Commit fb70282

Browse files
committed
* migrate to Vitepress
1 parent e9bdb6f commit fb70282

125 files changed

Lines changed: 15542 additions & 8177 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs-lint.yml

100644100755
File mode changed.

.gitignore

100644100755
File mode changed.

.mdlrc

100644100755
File mode changed.

.rubocop-md.yml

100644100755
File mode changed.

README.md

100644100755
File mode changed.

TRANSLATIONS.md

100644100755
File mode changed.

docs/.nojekyll

Whitespace-only changes.

docs/.vitepress/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cache/
2+
dist/
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import MarkdownIt from 'markdown-it'
2+
3+
export interface AvailableSinceParams {
4+
version?: string
5+
description?: string
6+
}
7+
8+
function parseAvailableSinceParams(info: string): AvailableSinceParams {
9+
const basicMatch = info.trim().match(/^available_since(?:\s+(.*))?$/)
10+
if (!basicMatch) return {}
11+
12+
const allParams = basicMatch[1] || ''
13+
const params: AvailableSinceParams = {}
14+
15+
const keyValueMatches = [
16+
...allParams.matchAll(/([a-z]+)(?:=("[^"]*"|[^\s"]+))?/g),
17+
]
18+
for (const [, key, value] of keyValueMatches) {
19+
let cleanValue = value ? value.replace(/^"|"$/g, '') : true
20+
21+
if (key === 'version') params.version = cleanValue as string
22+
if (key === 'description') params.description = cleanValue as string
23+
}
24+
25+
return params
26+
}
27+
28+
export function availableSinceMarkdownPlugin(md: MarkdownIt) {
29+
md.block.ruler.before(
30+
'paragraph',
31+
'available_since_oneliner',
32+
(state, start, end, silent) => {
33+
const line = state.getLines(start, start + 1, 0, false).trim()
34+
35+
const match = line.match(/^@available_since\s+(.+)$/)
36+
if (!match) return false
37+
38+
if (silent) return true
39+
40+
const params = parseAvailableSinceParams(`available_since ${match[1]}`)
41+
const token = state.push('available_since_oneliner', '', 0)
42+
43+
token.content = renderAvailableSince(params, md)
44+
token.map = [start, start + 1]
45+
46+
state.line = start + 1
47+
return true
48+
},
49+
)
50+
51+
md.renderer.rules.available_since_oneliner = (tokens, idx) => {
52+
return tokens[idx].content + '\n'
53+
}
54+
}
55+
56+
function renderAvailableSince(
57+
params: AvailableSinceParams,
58+
md: MarkdownIt,
59+
): string {
60+
const versionAttr = params.version
61+
? `version="${md.utils.escapeHtml(params.version)}"`
62+
: ''
63+
const descriptionAttr = params.description
64+
? `description="${md.utils.escapeHtml(params.description)}"`
65+
: ''
66+
67+
return `<AvailableSince ${versionAttr} ${descriptionAttr} />`
68+
}

docs/.vitepress/config.mts

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
import { defineConfig } from 'vitepress'
2+
import llmstxt from 'vitepress-plugin-llms'
3+
import { availableSinceMarkdownPlugin } from './availableSinceMarkdownPlugin'
4+
5+
const guideSidebar = [
6+
{
7+
text: 'Getting Started',
8+
items: [
9+
{ text: 'Getting Started', link: '/guide/getting_started' },
10+
{ text: 'Playbook', link: '/guide/playbook' },
11+
]
12+
},
13+
{
14+
text: 'Profilers',
15+
items: [
16+
{ text: 'Ruby Profilers', link: '/guide/profilers/ruby_profilers' },
17+
{ text: 'Event Profiler', link: '/guide/profilers/event_prof' },
18+
{ text: 'Tag Profiler', link: '/guide/profilers/tag_prof' },
19+
{ text: 'Factory Doctor', link: '/guide/profilers/factory_doctor' },
20+
{ text: 'Factory Profiler', link: '/guide/profilers/factory_prof' },
21+
{ text: 'RSpecDissect Profiler', link: '/guide/profilers/rspec_dissect' },
22+
{ text: 'Memory Profiler', link: '/guide/profilers/memory_prof' },
23+
{ text: 'TPS Profiler', link: '/guide/profilers/tps_prof' },
24+
]
25+
},
26+
{
27+
text: 'Recipes',
28+
items: [
29+
{ text: 'before_all Hook', link: '/guide/recipes/before_all' },
30+
{ text: 'let_it_be Helper', link: '/guide/recipes/let_it_be' },
31+
{ text: 'AnyFixture', link: '/guide/recipes/any_fixture' },
32+
{ text: 'FactoryDefault', link: '/guide/recipes/factory_default' },
33+
{ text: 'FactoryAllStub', link: '/guide/recipes/factory_all_stub' },
34+
{ text: 'RSpec Stamp', link: '/guide/recipes/rspec_stamp' },
35+
{ text: 'Tests Sampling', link: '/guide/recipes/tests_sampling' },
36+
{ text: 'Rails Logging', link: '/guide/recipes/logging' },
37+
]
38+
},
39+
{
40+
text: 'Misc',
41+
items: [
42+
{ text: 'RuboCop cops', link: '/guide/misc/rubocop' },
43+
]
44+
},
45+
]
46+
47+
const ruGuideSidebar = [
48+
{
49+
text: 'Начало работы',
50+
items: [
51+
{ text: 'Начало работы', link: '/ru/guide/getting_started' },
52+
]
53+
},
54+
{
55+
text: 'Профайлеры',
56+
items: [
57+
{ text: 'Ruby-профайлеры', link: '/ru/guide/profilers/ruby_prof' },
58+
{ text: 'Event Profiler', link: '/ru/guide/profilers/event_prof' },
59+
{ text: 'Tag Profiler', link: '/ru/guide/profilers/tag_prof' },
60+
{ text: 'Factory Doctor', link: '/ru/guide/profilers/factory_doctor' },
61+
{ text: 'Factory Profiler', link: '/ru/guide/profilers/factory_prof' },
62+
{ text: 'RSpecDissect Profiler', link: '/ru/guide/profilers/rspec_dissect' },
63+
]
64+
},
65+
{
66+
text: 'Рецепты',
67+
items: [
68+
{ text: 'before_all', link: '/ru/guide/recipes/before_all' },
69+
{ text: 'let_it_be', link: '/ru/guide/recipes/let_it_be' },
70+
{ text: 'AnyFixture', link: '/ru/guide/recipes/any_fixture' },
71+
{ text: 'FactoryDefault', link: '/ru/guide/recipes/factory_default' },
72+
{ text: 'FactoryAllStub', link: '/ru/guide/recipes/factory_all_stub' },
73+
{ text: 'RSpec Stamp', link: '/ru/guide/recipes/rspec_stamp' },
74+
{ text: 'Сэмплирование тестов', link: '/ru/guide/recipes/tests_sampling' },
75+
{ text: 'Логирование Rails', link: '/ru/guide/recipes/logging' },
76+
]
77+
},
78+
{
79+
text: 'Разное',
80+
items: [
81+
{ text: 'RuboCop копы', link: '/ru/guide/misc/rubocop' },
82+
]
83+
},
84+
]
85+
86+
const jaGuideSidebar = [
87+
{
88+
text: 'はじめに',
89+
items: [
90+
{ text: 'はじめに', link: '/ja/guide/getting_started' },
91+
{ text: 'プレイブック', link: '/ja/guide/playbook' },
92+
]
93+
},
94+
{
95+
text: 'プロファイラー',
96+
items: [
97+
{ text: 'Ruby プロファイラー', link: '/ja/guide/profilers/ruby_profilers' },
98+
{ text: 'Event Profiler', link: '/ja/guide/profilers/event_prof' },
99+
{ text: 'Tag Profiler', link: '/ja/guide/profilers/tag_prof' },
100+
{ text: 'Factory Doctor', link: '/ja/guide/profilers/factory_doctor' },
101+
{ text: 'Factory Profiler', link: '/ja/guide/profilers/factory_prof' },
102+
{ text: 'RSpecDissect Profiler', link: '/ja/guide/profilers/rspec_dissect' },
103+
{ text: 'Memory Profiler', link: '/ja/guide/profilers/memory_prof' },
104+
]
105+
},
106+
{
107+
text: 'レシピ',
108+
items: [
109+
{ text: 'before_all フック', link: '/ja/guide/recipes/before_all' },
110+
{ text: 'let_it_be ヘルパー', link: '/ja/guide/recipes/let_it_be' },
111+
{ text: 'AnyFixture', link: '/ja/guide/recipes/any_fixture' },
112+
{ text: 'FactoryDefault', link: '/ja/guide/recipes/factory_default' },
113+
{ text: 'FactoryAllStub', link: '/ja/guide/recipes/factory_all_stub' },
114+
{ text: 'RSpec Stamp', link: '/ja/guide/recipes/rspec_stamp' },
115+
{ text: 'テストサンプリング', link: '/ja/guide/recipes/tests_sampling' },
116+
{ text: 'Rails ログ', link: '/ja/guide/recipes/logging' },
117+
]
118+
},
119+
{
120+
text: 'その他',
121+
items: [
122+
{ text: 'RuboCop cops', link: '/ja/guide/misc/rubocop' },
123+
]
124+
},
125+
]
126+
127+
const zhCnGuideSidebar = [
128+
{
129+
text: '快速开始',
130+
items: [
131+
{ text: '快速开始', link: '/zh-cn/guide/getting_started' },
132+
{ text: 'Playbook', link: '/zh-cn/guide/playbook' },
133+
]
134+
},
135+
{
136+
text: '分析器',
137+
items: [
138+
{ text: 'Ruby 分析器', link: '/zh-cn/guide/profilers/ruby_profilers' },
139+
{ text: 'Event Profiler', link: '/zh-cn/guide/profilers/event_prof' },
140+
{ text: 'Tag Profiler', link: '/zh-cn/guide/profilers/tag_prof' },
141+
{ text: 'Factory Doctor', link: '/zh-cn/guide/profilers/factory_doctor' },
142+
{ text: 'Factory Profiler', link: '/zh-cn/guide/profilers/factory_prof' },
143+
{ text: 'RSpecDissect Profiler', link: '/zh-cn/guide/profilers/rspec_dissect' },
144+
{ text: 'Memory Profiler', link: '/zh-cn/guide/profilers/memory_prof' },
145+
]
146+
},
147+
{
148+
text: '秘诀',
149+
items: [
150+
{ text: 'before_all 钩子', link: '/zh-cn/guide/recipes/before_all' },
151+
{ text: 'let_it_be 助手', link: '/zh-cn/guide/recipes/let_it_be' },
152+
{ text: 'AnyFixture', link: '/zh-cn/guide/recipes/any_fixture' },
153+
{ text: 'FactoryDefault', link: '/zh-cn/guide/recipes/factory_default' },
154+
{ text: 'FactoryAllStub', link: '/zh-cn/guide/recipes/factory_all_stub' },
155+
{ text: 'RSpec Stamp', link: '/zh-cn/guide/recipes/rspec_stamp' },
156+
{ text: '测试采样', link: '/zh-cn/guide/recipes/tests_sampling' },
157+
{ text: 'Rails 日志', link: '/zh-cn/guide/recipes/logging' },
158+
]
159+
},
160+
{
161+
text: '其他',
162+
items: [
163+
{ text: 'RuboCop cops', link: '/zh-cn/guide/misc/rubocop' },
164+
]
165+
},
166+
]
167+
168+
export default defineConfig({
169+
title: "TestProf",
170+
description: "Ruby tests profiling and optimization toolbox",
171+
172+
cleanUrls: true,
173+
ignoreDeadLinks: true,
174+
175+
vite: {
176+
plugins: [
177+
llmstxt(),
178+
],
179+
},
180+
181+
markdown: {
182+
config(md) {
183+
md.use(availableSinceMarkdownPlugin)
184+
},
185+
},
186+
187+
head: [
188+
['link', { rel: 'icon', href: '/favicon.ico' }],
189+
['meta', { name: 'theme-color', content: '#a088ad' }],
190+
['meta', { property: 'og:title', content: 'TestProf' }],
191+
['meta', { property: 'og:description', content: 'Ruby tests profiling and optimization toolbox' }],
192+
['meta', { property: 'og:image', content: 'https://test-prof.evilmartians.io/assets/images/banner.png' }],
193+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
194+
['meta', { name: 'twitter:site', content: '@palkan_tula' }],
195+
['meta', { name: 'twitter:creator', content: '@palkan_tula' }],
196+
['meta', { name: 'keywords', content: 'ruby, rails, testing, profiling' }],
197+
],
198+
199+
locales: {
200+
root: {
201+
label: 'English',
202+
lang: 'en',
203+
themeConfig: {
204+
nav: [
205+
{ text: 'Guide', link: '/guide/getting_started', activeMatch: '/guide/' },
206+
{ text: 'LLMs', link: '/llms-full.txt' },
207+
],
208+
sidebar: {
209+
'/guide/': guideSidebar,
210+
},
211+
},
212+
},
213+
ru: {
214+
label: 'Русский',
215+
lang: 'ru',
216+
description: 'Инструменты для профилирования и оптимизации тестов на Ruby',
217+
themeConfig: {
218+
nav: [
219+
{ text: 'Руководство', link: '/ru/guide/getting_started', activeMatch: '/ru/guide/' },
220+
],
221+
sidebar: {
222+
'/ru/guide/': ruGuideSidebar,
223+
},
224+
editLink: {
225+
pattern: 'https://github.com/test-prof/docs/edit/master/docs/:path',
226+
text: 'Редактировать на GitHub',
227+
},
228+
},
229+
},
230+
ja: {
231+
label: '日本語',
232+
lang: 'ja',
233+
description: 'Rubyテストのプロファイリングと最適化ツールボックス',
234+
themeConfig: {
235+
nav: [
236+
{ text: 'ガイド', link: '/ja/guide/getting_started', activeMatch: '/ja/guide/' },
237+
],
238+
sidebar: {
239+
'/ja/guide/': jaGuideSidebar,
240+
},
241+
editLink: {
242+
pattern: 'https://github.com/test-prof/docs/edit/master/docs/:path',
243+
text: 'GitHubで編集',
244+
},
245+
},
246+
},
247+
'zh-cn': {
248+
label: '中文',
249+
lang: 'zh-CN',
250+
description: 'Ruby测试分析和优化工具箱',
251+
themeConfig: {
252+
nav: [
253+
{ text: '指南', link: '/zh-cn/guide/getting_started', activeMatch: '/zh-cn/guide/' },
254+
],
255+
sidebar: {
256+
'/zh-cn/guide/': zhCnGuideSidebar,
257+
},
258+
editLink: {
259+
pattern: 'https://github.com/test-prof/docs/edit/master/docs/:path',
260+
text: '在GitHub上编辑',
261+
},
262+
},
263+
},
264+
},
265+
266+
themeConfig: {
267+
logo: '/assets/images/logo.svg',
268+
269+
socialLinks: [
270+
{ icon: 'github', link: 'https://github.com/test-prof/test-prof' }
271+
],
272+
273+
search: {
274+
provider: 'local'
275+
},
276+
277+
editLink: {
278+
pattern: 'https://github.com/test-prof/docs/edit/master/docs/:path'
279+
},
280+
}
281+
})

0 commit comments

Comments
 (0)