Skip to content

Commit

Permalink
chore(docs): Started initial v2 Release Notes/Blog
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Jun 15, 2020
1 parent bcb80ff commit 88fb6a0
Show file tree
Hide file tree
Showing 20 changed files with 1,208 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/dev-utils/src/indexer/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default async function generate(
if (markdown) {
if (route.endsWith("/changelog")) {
type = "changelog";
} else if (route.startsWith("/blog")) {
type = "blog";
} else {
type = "guide";
}
Expand Down Expand Up @@ -62,6 +64,9 @@ export default async function generate(
default:
throw new Error("This should never happen.");
}
} else if (route === "/blog") {
type = "blog";
summary = "The latest news about react-md";
} else {
throw new Error(`Unhandled route type: "${route}"`);
}
Expand All @@ -78,6 +83,8 @@ export default async function generate(
let pageUrl = route;
if (route.startsWith("/guides")) {
pageUrl = "/guides/[id]";
} else if (route.startsWith("/blog/")) {
pageUrl = "/blog/[id]";
} else if (route.startsWith("/packages") && !route.endsWith("demos")) {
const [suffix] = route.split("/").reverse();
pageUrl = `/packages/[id]/${suffix}`;
Expand Down
10 changes: 8 additions & 2 deletions packages/dev-utils/src/indexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ export default async function indexer(): Promise<void> {
const guides = await glob("*.md", { cwd: guidesFolder });
const changelogsFolder = join(documentationRoot, src, "changelogs");
const changelogs = await glob("*.md", { cwd: changelogsFolder });

const routes = await getRoutes({ guides, changelogs });
const blogsFolder = join(documentationRoot, src, "blogs");
const blogs = await glob("*.md", { cwd: blogsFolder, ignore: ["index.md"] });

const routes = await getRoutes({
guides,
changelogs,
blogs,
});
const { tocs, metadata } = await generate(routes);

const meta = join(documentationRoot, src, "constants", "meta");
Expand Down
1 change: 1 addition & 0 deletions packages/dev-utils/src/indexer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface DemoMetadata {
}

export type MetadataType =
| "blog"
| "guide"
| "theme"
| "sassdoc"
Expand Down
7 changes: 6 additions & 1 deletion packages/dev-utils/src/indexer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const replaceIds = (pathname: string, values: readonly string[]): string[] =>
interface GetRoutesOptions {
guides: readonly string[];
changelogs: readonly string[];
blogs: readonly string[];
}

export async function getRoutes({
guides,
changelogs,
blogs,
}: GetRoutesOptions): Promise<string[]> {
const pagesFolder = join(documentationRoot, src, "pages");
const paths = await glob("**/*.+(ts|tsx)", {
Expand All @@ -56,6 +58,7 @@ export async function getRoutes({
const pathname = `/${filePath
.replace(new RegExp(sep, "g"), "/")
.replace(/\..+$/, "")
.replace("blog/index", "blog")
.replace(/.+\/index$/, "")}`;

switch (pathname) {
Expand All @@ -66,6 +69,8 @@ export async function getRoutes({
return "";
case "/guides/[id]":
return replaceIds(pathname, guides);
case "/blog/[id]":
return replaceIds(pathname, blogs);
case "/packages/[id]/api":
return replaceIds(pathname, apiablePackages);
case "/packages/[id]/demos":
Expand Down Expand Up @@ -95,7 +100,7 @@ function pluralize(s: string): string {
}

export function getMarkdownForRoute(route: string): string | null {
const simpleReadmeMatch = route.match(/^\/(guides)\//);
const simpleReadmeMatch = route.match(/^\/(blog|guides)\//);
const packageMarkdownMatch = route.match(/\/(installation|changelog)$/);

let path = "";
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@react-md/utils": "^2.0.0-beta.2",
"codesandbox": "^2.1.14",
"cookie-parser": "^1.4.5",
"date-fns": "^2.14.0",
"express": "^4.17.1",
"fuse.js": "6.0.4",
"helmet": "^3.22.0",
Expand Down
33 changes: 33 additions & 0 deletions packages/documentation/src/blogs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Title: react-md 2.0.0

Date: 06/13/2020

Read More: v2-release

Summary:

The v2 release is a complete re-write of react-md to address the majority of
problems encountered while using v1. Unfortunately, this took a **lot** longer
than I had hoped since I ended up using this project to learn
[Typescript](https://www.typescriptlang.org/) as well as the new
[React hooks API](https://reactjs.org/docs/hooks-intro.html). Even though there
are some missing components from v1, I think the new functionality outweighs it
and the components are scoped for a later release.

The 2.0.0 release of react-md features:

- Rewrite to Typescript
- New Behavior for Determining the Current Application Size
- New Theme API
- New Utility SCSS Functions and Mixins
- SCSS Variables and Default Values in JavaScript
- Automatic Color fixes for Accessible Contrast Ratios
- Improved Typography and CSS Reset
- Improved User Interaction States
- Improved Accessibility and Keyboard Movement
- Right to left Language Support
- Convenience Configuration and Context Provider Components
- Around 50 new Components and 40 hooks
- All Material Icons Available as Components
- Scoped Packages
- New Documentation Site
Loading

0 comments on commit 88fb6a0

Please sign in to comment.