Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 4cd9671

Browse files
authored
Merge pull request #116 from chakra-ui/changelog
refactor: changelog generation
2 parents af56bae + d8943b1 commit 4cd9671

File tree

8 files changed

+2388
-78
lines changed

8 files changed

+2388
-78
lines changed

CONTRIBUTING.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,23 @@ When it comes to open source, there are different ways you can contribute, all
44
of which are valuable. Here's a few guidelines that should help you as you
55
prepare your contribution.
66

7+
Here's the table of contents:
8+
9+
- [Setup the Project](#setup-the-project)
10+
- [Commands](#commands)
11+
- [Updating the docs for new release](#updating-the-docs-for-new-release)
12+
- [Proposing new or changed API?](#proposing-new-or-changed-api)
13+
- [Making a Pull Request?](#making-a-pull-request)
14+
- [Commit Convention](#commit-convention)
15+
- [Steps to PR](#steps-to-pr)
16+
- [Want to write a blog post or tutorial](#want-to-write-a-blog-post-or-tutorial)
17+
- [Want to help improve the docs?](#want-to-help-improve-the-docs)
18+
- [License](#license)
19+
720
## Setup the Project
821

9-
Setting up the docsite project is easy. It's a Next JS site. The following steps will get you up and running to contribute to the Chakra UI docsite:
22+
Setting up the docsite project is easy. It's a Next JS site. The following steps
23+
will get you up and running to contribute to the Chakra UI docsite:
1024

1125
1. Fork the repo (click the <kbd>Fork</kbd> button at the top right of
1226
[this page](https://github.com/chakra-ui/chakra-ui-docs))
@@ -21,8 +35,8 @@ cd chakra-ui-docs
2135
1. Setup all the dependencies and packages by running `yarn`.
2236
2. Execute `yarn dev` to spin up a local development server
2337

24-
> If you run into any issues, kindly reach out to the Chakra UI
25-
> React team here: https://discord.gg/chakra-ui
38+
> If you run into any issues, kindly reach out to the Chakra UI React team here:
39+
> https://discord.gg/chakra-ui
2640
2741
### Commands
2842

@@ -34,6 +48,16 @@ cd chakra-ui-docs
3448

3549
**`yarn lint`**: runs the nextjs linter which checks for code issues.
3650

51+
## Updating the docs for new release
52+
53+
When a new version of `@chakra-ui/react` has been released, here's what you need
54+
to do to get it reflected in the docs:
55+
56+
- Bump the version of `@chakra-ui/react`
57+
- Run `yarn changelog:gen` to fetch the most recent changelog from the
58+
[main repository](https://github.com/chakra-ui/chakra-ui)
59+
- Open a Pull Request titled `docs: updates for new release`
60+
3761
## Proposing new or changed API?
3862

3963
Please provide thoughtful comments and some sample API code. Proposals that
@@ -54,8 +78,7 @@ When you create a commit we kindly ask you to follow the convention
5478
`category(scope or module): message` in your commit message while using one of
5579
the following categories:
5680

57-
- `feat / feature`: all changes that introduce completely new code or new
58-
features
81+
- `feat`: all changes that introduce completely new code or new features
5982
- `fix`: changes that fix a bug (ideally you will additionally reference an
6083
issue if present)
6184
- `refactor`: any code related change that is not a fix nor a feature
@@ -85,7 +108,9 @@ https://www.conventionalcommits.org/ or check out the
85108

86109
3. Make and commit your changes following the
87110
[commit convention](https://github.com/chakra-ui/chakra-ui-docs/blob/main/CONTRIBUTING.md#commit-convention).
88-
As you develop, you can run `yarn lint` and `yarn lint` to make sure everything works as expected. Please note that you might have to run `yarn` first in order to install all dependencies.
111+
As you develop, you can run `yarn lint` and `yarn lint` to make sure
112+
everything works as expected. Please note that you might have to run `yarn`
113+
first in order to install all dependencies.
89114

90115
## Want to write a blog post or tutorial
91116

contentlayer.config.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import {
22
ComputedFields,
33
defineDocumentType,
44
makeSource,
5-
} from 'contentlayer/source-files';
6-
import remarkEmoji from 'remark-emoji';
7-
import remarkGfm from 'remark-gfm';
8-
import remarkSlug from 'remark-slug';
9-
import siteConfig from './configs/site-config';
10-
import { getTableOfContents } from './src/utils/mdx-utils';
11-
import { rehypeMdxCodeMeta } from './src/utils/rehype-code-meta';
5+
} from 'contentlayer/source-files'
6+
import remarkEmoji from 'remark-emoji'
7+
import remarkGfm from 'remark-gfm'
8+
import remarkSlug from 'remark-slug'
9+
import siteConfig from './configs/site-config'
10+
import { getTableOfContents } from './src/utils/mdx-utils'
11+
import { rehypeMdxCodeMeta } from './src/utils/rehype-code-meta'
1212

1313
const computedFields: ComputedFields = {
1414
slug: {
@@ -19,7 +19,7 @@ const computedFields: ComputedFields = {
1919
type: 'string',
2020
resolve: (doc) => `${siteConfig.repo.editUrl}/${doc._id}`,
2121
},
22-
};
22+
}
2323

2424
const Blog = defineDocumentType(() => ({
2525
name: 'Blog',
@@ -41,7 +41,7 @@ const Blog = defineDocumentType(() => ({
4141
}),
4242
},
4343
},
44-
}));
44+
}))
4545

4646
const Guides = defineDocumentType(() => ({
4747
name: 'Guide',
@@ -67,7 +67,7 @@ const Guides = defineDocumentType(() => ({
6767
}),
6868
},
6969
},
70-
}));
70+
}))
7171

7272
const Doc = defineDocumentType(() => ({
7373
name: 'Doc',
@@ -95,7 +95,7 @@ const Doc = defineDocumentType(() => ({
9595
}),
9696
},
9797
},
98-
}));
98+
}))
9999

100100
const FAQ = defineDocumentType(() => ({
101101
name: 'FAQ',
@@ -117,15 +117,35 @@ const FAQ = defineDocumentType(() => ({
117117
}),
118118
},
119119
},
120-
}));
120+
}))
121+
122+
const Changelog = defineDocumentType(() => ({
123+
name: 'Changelog',
124+
filePathPattern: 'changelog/*.mdx',
125+
bodyType: 'mdx',
126+
fields: {
127+
title: { type: 'string', required: true },
128+
description: { type: 'string', required: true },
129+
},
130+
computedFields: {
131+
frontMatter: {
132+
type: 'json',
133+
resolve: (doc) => ({
134+
title: doc.title,
135+
description: doc.description,
136+
slug: '/changelog',
137+
}),
138+
},
139+
},
140+
}))
121141

122142
const contentLayerConfig = makeSource({
123143
contentDirPath: 'pages',
124-
documentTypes: [Blog, Doc, Guides, FAQ],
144+
documentTypes: [Blog, Doc, Guides, FAQ, Changelog],
125145
mdx: {
126146
rehypePlugins: [rehypeMdxCodeMeta],
127147
remarkPlugins: [remarkSlug, remarkGfm, remarkEmoji],
128148
},
129-
});
149+
})
130150

131-
export default contentLayerConfig;
151+
export default contentLayerConfig

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"members:gen": "ts-node scripts/all-members.ts",
1212
"search-meta:gen": "ts-node scripts/get-search-meta.ts",
1313
"showcase-data:gen": "ts-node scripts/get-showcase-data.ts",
14+
"changelog:gen": "ts-node scripts/get-changelog.ts",
1415
"prop-table": "yarn props-docs build",
1516
"start": "next start",
1617
"test": "jest",

pages/changelog.tsx

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

0 commit comments

Comments
 (0)