118 lines
6.2 KiB
Markdown
118 lines
6.2 KiB
Markdown
|
# Gatsby's Typescript + Material-ui starter
|
|||
|
|
|||
|
[![Netlify Status](https://api.netlify.com/api/v1/badges/1b625068-4ac6-42d5-87fb-902d9077bbef/deploy-status)](https://app.netlify.com/sites/gatsby-material-typescript-starter/deploys)
|
|||
|
|
|||
|
Kick off your project with this [Material-ui](https://material-ui.com/) boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React.
|
|||
|
It includes support for Typescript in front-side and node-side and uses Eslint & Prettier.
|
|||
|
|
|||
|
This starter don't have any source or style supports, it's your choice.
|
|||
|
|
|||
|
_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._
|
|||
|
|
|||
|
## 🚀 Quick start
|
|||
|
|
|||
|
1. **Create a Gatsby site.**
|
|||
|
|
|||
|
Use the Gatsby CLI to create a new site, specifying the default starter.
|
|||
|
|
|||
|
```shell
|
|||
|
# create a new Gatsby site using the starter
|
|||
|
gatsby new gatsby-material-typescript-starter https://github.com/Junscuzzy/gatsby-material-typescript-starter
|
|||
|
```
|
|||
|
|
|||
|
1. **Start developing.**
|
|||
|
|
|||
|
Navigate into your new site’s directory and start it up.
|
|||
|
|
|||
|
```shell
|
|||
|
cd gatsby-material-typescript-starter/
|
|||
|
yarn develop
|
|||
|
```
|
|||
|
|
|||
|
1. **Open the source code and start editing!**
|
|||
|
|
|||
|
Your site is now running at `http://localhost:8000`!
|
|||
|
|
|||
|
_Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql)._
|
|||
|
|
|||
|
Open the `gatsby-material-typescript-starter` directory in your code editor of choice and edit `src/pages/index.tsx`. Save your changes and the browser will update in real time!
|
|||
|
|
|||
|
1. **Bonus**: Check all linters using
|
|||
|
|
|||
|
```shell
|
|||
|
yarn lint
|
|||
|
```
|
|||
|
|
|||
|
Will execute Prettier, Eslint and Typescript checking
|
|||
|
|
|||
|
All the commands are in your `package.json > scripts`.
|
|||
|
|
|||
|
## 🧐 What's inside?
|
|||
|
|
|||
|
A quick look at the top-level files and directories you'll see in a Gatsby project.
|
|||
|
|
|||
|
.
|
|||
|
├── .vscode/
|
|||
|
├── node_modules/
|
|||
|
├── src/
|
|||
|
├── static/
|
|||
|
├── .editorconfig
|
|||
|
├── .eslintrc
|
|||
|
├── .gitignore
|
|||
|
├── .prettierrc
|
|||
|
├── gatsby-browser.js
|
|||
|
├── gatsby-config.js
|
|||
|
├── gatsby-node.js
|
|||
|
├── gatsby-ssr.js
|
|||
|
├── LICENSE
|
|||
|
├── package.json
|
|||
|
├── README.md
|
|||
|
├── tsconfig.json
|
|||
|
└── yarn.lock
|
|||
|
|
|||
|
1. **`/.vscode`**: VSCode projects settings.
|
|||
|
|
|||
|
1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
|
|||
|
|
|||
|
1. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
|
|||
|
|
|||
|
1. **`/static`**: Static files like `robots.txt` or `favicon.ico`.
|
|||
|
|
|||
|
1. **`.editorconfig`**: EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
|
|||
|
|
|||
|
1. **`.eslintrc`**: This is a configuration file for [Eslint](https://eslint.org/). Find and fix problems in your JavaScript code
|
|||
|
|
|||
|
1. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
|
|||
|
|
|||
|
1. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
|
|||
|
|
|||
|
1. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
|
|||
|
|
|||
|
1. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
|
|||
|
|
|||
|
1. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
|
|||
|
|
|||
|
1. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
|
|||
|
|
|||
|
1. **`LICENSE`**: Gatsby is licensed under the MIT license.
|
|||
|
|
|||
|
1. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
|
|||
|
|
|||
|
1. **`README.md`**: A text file containing useful reference information about your project.
|
|||
|
|
|||
|
1. **`tsconfig.json`**: This is a configuration file for [Typescript](https://www.typescriptlang.org/). TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
|
|||
|
|
|||
|
1. **`yarn.lock`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
|
|||
|
|
|||
|
## 🎓 Learning Gatsby
|
|||
|
|
|||
|
Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.org/). Here are some places to start:
|
|||
|
|
|||
|
- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
|
|||
|
|
|||
|
- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
|
|||
|
|
|||
|
## 💫 Deploy
|
|||
|
|
|||
|
As a static generated website, you can deploy it on [Netlify](https://www.netlify.com), [Github Page](https://pages.github.com/) or [ZEIT Now](https://zeit.co/)
|