Skip to content

Commit d277da1

Browse files
authored
refactor(docusarus): docusaurus migration (#612)
1 parent 54b30a9 commit d277da1

File tree

188 files changed

+16447
-11587
lines changed

Some content is hidden

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

188 files changed

+16447
-11587
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ node_modules
55
lib/core/metadata.js
66
lib/core/MetadataBlog.js
77

8-
website/translated_docs
9-
website/build/
10-
website/i18n/*
8+
translated_docs
9+
build/
10+
i18n/*
11+
.docusaurus
12+
.cache-loader
1113

1214
*.log
1315

.vscode/markdown.code-snippets

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,47 @@
11
{
2-
// Place your testing-library-docs workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3-
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4-
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5-
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6-
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7-
// Placeholders with the same ids are connected.
8-
// Example:
9-
// "Print to console": {
10-
// "scope": "javascript,typescript",
11-
// "prefix": "log",
12-
// "body": [
13-
// "console.log('$1');",
14-
// "$2"
15-
// ],
16-
// "description": "Log output to console"
17-
// },
18-
"Multilanguage Code Block": {
19-
"scope": "markdown",
20-
"prefix": "docblock",
21-
"body": [
22-
"```html",
23-
"$4",
24-
"```",
25-
"",
26-
"<!--DOCUSAURUS_CODE_TABS-->",
27-
"",
28-
"<!--Native-->",
29-
"```js",
30-
"import { $1 } from '@testing-library/dom'",
31-
"",
32-
"const container = document.body",
33-
"const $3 = $1(container, '$2')",
34-
"```",
35-
"",
36-
"<!--React-->",
37-
"```js",
38-
"import { render } from '@testing-library/react'",
39-
"",
40-
"const { $1 } = render(<MyComponent />)",
41-
"const $3 = $1('$2')",
42-
"```",
43-
"",
44-
"<!--Cypress-->",
45-
"```js",
46-
"cy.$1('$2').should('exist')",
47-
"```",
48-
"",
49-
"<!--END_DOCUSAURUS_CODE_TABS-->"
50-
],
51-
"description": "Create a Docusaurus multi-language code block"
52-
}
53-
}
2+
"MDX title": {
3+
"prefix": "mdxtitle",
4+
"body": ["---", "id: $1", "title: $2", "sidebar_label: $3", "---"],
5+
"description": "MDX file titles"
6+
},
7+
"MDX Multilingual Tabs": {
8+
"prefix": "mdxtabs",
9+
"body": [
10+
"",
11+
"import Tabs from '@theme/Tabs';",
12+
"import TabItem from '@theme/TabItem';",
13+
"",
14+
" <Tabs",
15+
" defaultValue=\"native\"",
16+
" values={[",
17+
" { label: 'Native', value: 'native' },",
18+
" { label: 'React', value: 'react' },",
19+
" { label: 'Cypress', value: 'cypress' }]",
20+
" }>",
21+
" <TabItem value=\"native\">",
22+
"",
23+
" ```js",
24+
" $1",
25+
" ```",
26+
"",
27+
" </TabItem>",
28+
" <TabItem value=\"react\">",
29+
"",
30+
" ```jsx",
31+
" $2",
32+
" ```",
33+
"",
34+
" </TabItem>",
35+
" <TabItem value=\"cypress\">",
36+
"",
37+
" ```js",
38+
" $3",
39+
" ```",
40+
"",
41+
" </TabItem>",
42+
" </Tabs>",
43+
""
44+
],
45+
"description": "MDX multilingual tabs"
46+
}
47+
}

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"editor.rulers": [
33
60, // try to keep examples this long
44
80, // hard wrap
5-
]
5+
],
6+
"files.associations": {
7+
"*.md": "mdx"
8+
},
69
}

Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ testing-library-docs
1010

1111
Documentation site for [React Testing Library](https://github.com/testing-library/react-testing-library), [DOM Testing Library](https://github.com/testing-library/dom-testing-library), and [related projects](https://github.com/testing-library)
1212

13-
See [./website/README.md](./website/README.md) for instructions on building the site
14-
1513
**https://testing-library.com**
1614

1715
**Build Status**:
@@ -26,6 +24,108 @@ See [./website/README.md](./website/README.md) for instructions on building the
2624
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
2725
[coc]: https://github.com/testing-library/react-testing-library/blob/master/CODE_OF_CONDUCT.md
2826

27+
This website was created with [Docusaurus](https://v2.docusaurus.io).
28+
29+
# What's In This Document
30+
31+
- [Get Started in 5 Minutes](#get-started-in-5-minutes)
32+
- [Directory Structure](#directory-structure)
33+
- [Editing Content](#editing-content)
34+
- [Adding Content](#adding-content)
35+
- [Full Documentation](#full-documentation)
36+
37+
# Get Started in 5 Minutes
38+
39+
1. Make sure all the dependencies for the website are installed:
40+
41+
```sh
42+
# Install dependencies
43+
$ npm install
44+
```
45+
46+
2. Run your dev server:
47+
48+
```sh
49+
# Start the site
50+
$ npm run start
51+
```
52+
53+
# Editing Content
54+
55+
## Editing an existing docs page
56+
57+
Edit docs by navigating to `docs/` and editing the corresponding document:
58+
59+
`docs/doc-to-be-edited.mdx`
60+
61+
```markdown
62+
---
63+
id: page-needs-edit
64+
title: This Doc Needs To Be Edited
65+
---
66+
67+
Edit me...
68+
```
69+
70+
For more information about docs, click [here](https://v2.docusaurus.io/docs)
71+
72+
## Editing an existing blog post
73+
74+
Edit blog posts by navigating to `blog` and editing the corresponding
75+
post:
76+
77+
`blog/post-to-be-edited.mdx`
78+
79+
```markdown
80+
---
81+
id: post-needs-edit
82+
title: This Blog Post Needs To Be Edited
83+
---
84+
85+
Edit me...
86+
```
87+
88+
For more information about blog posts, click
89+
[here](https://v2.docusaurus.io/docs/blog)
90+
91+
# Adding Content
92+
93+
## Adding a new docs page to an existing sidebar
94+
95+
1. Create the doc as a new markdown file in `/docs`, example
96+
`docs/newly-created-doc.mdx`:
97+
98+
```md
99+
---
100+
id: newly-created-doc
101+
title: This Doc Needs To Be Edited
102+
---
103+
104+
My new content here..
105+
```
106+
107+
Note: Ensure the file name and the id value do not include non-url safe
108+
characters i.e. '\*'.
109+
110+
2. Refer to that doc's ID in an existing sidebar in `sidebar.json`:
111+
112+
```javascript
113+
// Add newly-created-doc to the Getting Started category of docs
114+
{
115+
"docs": {
116+
"Getting Started": [
117+
"quick-start",
118+
"newly-created-doc" // new doc here
119+
],
120+
...
121+
},
122+
...
123+
}
124+
```
125+
126+
For more information about adding new docs, click
127+
[here](https://v2.docusaurus.io/docs/)
128+
29129
## Contributors
30130

31131
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

website/blog/2018-12-29-new-site.md renamed to blog/2018-12-29-new-site.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: New Site
33
author: Alex Krolick
4-
authorURL: http://github.com/alexkrolick
4+
authorURL: 'http://github.com/alexkrolick'
55
---
66

77
We have a docs site now! It's built with [Docusaurus](https://docusaurus.io).
@@ -20,6 +20,6 @@ beyond!
2020

2121
🎉 Happy new year!
2222

23-
[dtl]: /
24-
[rtl]: /react
25-
[ctl]: /cypress
23+
[dtl]: /docs/dom-testing-library/intro
24+
[rtl]: /docs/react-testing-library/intro
25+
[ctl]: /docs/cypress-testing-library/intro

website/blog/2019-03-17-code-blocks.md renamed to blog/2019-03-17-code-blocks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Multi-Framework Code Blocks
33
author: Alex Krolick
4-
authorURL: http://github.com/alexkrolick
4+
authorURL: "http://github.com/alexkrolick"
55
---
66

77
Many of the code samples have been updated to include tabs to switch between

website/blog/2019-04-25-new-org.md renamed to blog/2019-04-25-new-org.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
# prettier doesn't like how long this line is.
3-
# prettier-ignore
2+
# prettier doesn't like how long this line is.: ""
3+
# prettier-ignore: ""
44
title: "Testing Library Updates: new release, github org, open collective, and twitter account"
55
author: Kent C. Dodds
6-
authorURL: https://kentcdodds.com
7-
authorImageURL: https://avatars0.githubusercontent.com/u/1500684?s=120&v=4
6+
authorURL: "https://kentcdodds.com"
7+
authorImageURL: "https://avatars0.githubusercontent.com/u/1500684?s=120&v=4"
88
---
99

1010
Hello friends! I'm pleased to announce the recent updates to the testing-library
@@ -35,8 +35,7 @@ just disable it here -->
3535
<iframe
3636
src="https://codesandbox.io/embed/9zw1wv59mw?fontsize=14&module=%2Fsrc%2F__tests__%2Findex.js&previewwindow=tests&view=editor"
3737
title="React Codesandbox"
38-
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
39-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
38+
style={{width: '100%', height:500, border:0, borderRadius: 4, overflow:'hidden'}} sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
4039
></iframe>
4140

4241
We hope that this helps you catch bugs better!
@@ -148,7 +147,7 @@ and more gets added to it daily. If you know of blog posts, YouTube videos,
148147
courses, or anything else about the Testing Library family of tools, please
149148
contribute to the list!
150149

151-
> [Contribute to the learning materials page](https://github.com/testing-library/testing-library-docs/edit/master/docs/learning.md)
150+
> [Contribute to the learning materials page](https://github.com/testing-library/testing-library-docs/edit/master/docs/learning.mdx)
152151
153152
## Other Exciting news
154153

docker-compose.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)