Skip to content

Commit

Permalink
Replace JS blog-starter example with TS, deprecate `blog-starter-ty…
Browse files Browse the repository at this point in the history
…pescript` example (#38395)

* Replace `blog-starter` JS example with `blog-starter-typescript`

* lint-fix, Revert pnpm-lock.yaml

* Revert root readme.md

* Add useful sections omitted from original Typescript convert

Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
maxproske and ijjk authored Jul 8, 2022
1 parent 6faf84f commit 8783793
Show file tree
Hide file tree
Showing 94 changed files with 49 additions and 870 deletions.
37 changes: 0 additions & 37 deletions examples/blog-starter-typescript/.gitignore

This file was deleted.

36 changes: 2 additions & 34 deletions examples/blog-starter-typescript/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
# A statically generated blog example using Next.js, Markdown, and TypeScript
## Deprecated

This is the existing [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) plus TypeScript.

This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using Markdown files as the data source.

The blog posts are stored in `/_posts` as Markdown files with front matter support. Adding a new Markdown file in there will create a new blog post.

To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the Markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page.

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/blog-starter-typescript)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/blog-starter-typescript&project-name=blog-starter-typescript&repository-name=blog-starter-typescript)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:

```bash
npx create-next-app --example blog-starter-typescript blog-starter-typescript-app
# or
yarn create next-app --example blog-starter-typescript blog-starter-typescript-app
# or
pnpm create next-app --example blog-starter-typescript blog-starter-typescript-app
```

Your blog should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

# Notes

`blog-starter-typescript` uses [Tailwind CSS](https://tailwindcss.com) [(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3).
The main [blog-starter](/examples/blog-starter) example has been refactored to use TypeScript, so this example is deprecated.
19 changes: 0 additions & 19 deletions examples/blog-starter-typescript/_posts/dynamic-routing.md

This file was deleted.

19 changes: 0 additions & 19 deletions examples/blog-starter-typescript/_posts/hello-world.md

This file was deleted.

19 changes: 0 additions & 19 deletions examples/blog-starter-typescript/_posts/preview.md

This file was deleted.

11 changes: 0 additions & 11 deletions examples/blog-starter-typescript/components/container.tsx

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions examples/blog-starter-typescript/lib/constants.ts

This file was deleted.

29 changes: 0 additions & 29 deletions examples/blog-starter-typescript/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions examples/blog-starter-typescript/postcss.config.js

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions examples/blog-starter-typescript/styles/index.css

This file was deleted.

7 changes: 0 additions & 7 deletions examples/blog-starter-typescript/tailwind.config.js

This file was deleted.

3 changes: 3 additions & 0 deletions examples/blog-starter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ yarn-error.log*

# vercel
.vercel

# typescript
*.tsbuildinfo
8 changes: 5 additions & 3 deletions examples/blog-starter/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# A statically generated blog example using Next.js and Markdown
# A statically generated blog example using Next.js, Markdown, and TypeScript

This is the existing [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) plus TypeScript.

This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using Markdown files as the data source.

Expand Down Expand Up @@ -51,6 +53,6 @@ Your blog should be up and running on [http://localhost:3000](http://localhost:3

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

## Notes
# Notes

This blog-starter uses [Tailwind CSS](https://tailwindcss.com) [(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3).
`blog-starter` uses [Tailwind CSS](https://tailwindcss.com) [(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3).
42 changes: 0 additions & 42 deletions examples/blog-starter/components/alert.js

This file was deleted.

File renamed without changes.
15 changes: 0 additions & 15 deletions examples/blog-starter/components/avatar.js

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions examples/blog-starter/components/container.js

This file was deleted.

9 changes: 9 additions & 0 deletions examples/blog-starter/components/container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type Props = {
children?: React.ReactNode
}

const Container = ({ children }: Props) => {
return <div className="container mx-auto px-5">{children}</div>
}

export default Container
29 changes: 0 additions & 29 deletions examples/blog-starter/components/cover-image.js

This file was deleted.

6 changes: 0 additions & 6 deletions examples/blog-starter/components/date-formatter.js

This file was deleted.

30 changes: 0 additions & 30 deletions examples/blog-starter/components/footer.js

This file was deleted.

File renamed without changes.
12 changes: 0 additions & 12 deletions examples/blog-starter/components/header.js

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 8783793

Please sign in to comment.