Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Migrated Gatsby website source and config
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Oct 4, 2017
1 parent 93aa551 commit 9d9b202
Show file tree
Hide file tree
Showing 93 changed files with 16,351 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ['react', 'es2015', 'stage-1'],
"plugins": ['add-module-exports']
}
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/*

# Ignore markdown files and examples
content/*

# Ignore built files
public/*
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"plugins": [
"prettier",
"react"
],
"parser": "babel-eslint",
}
33 changes: 33 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[ignore]

<PROJECT_ROOT>/content/.*
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/public/.*

[include]

[libs]
./node_modules/fbjs/flow/lib/dev.js
./flow

[options]
module.system=haste

esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
unsafe.enable_getters_and_setters=true

munge_underscores=false

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_type=$FlowExpectedError

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.56.0
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
.DS_STORE
node_modules
public
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.4
393 changes: 393 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# reactjs.org

## Getting started

### Prerequisites

1. Git
1. Node: install version 8.4 or greater
1. Yarn: `npm i -g yarn` to install it globally via NPM
1. A clone of the [reactjs.org repo](https://github.com/facebook/reactjs.org) on your local machine
1. A fork of the repo (for any contributions)

### Installation

1. `cd reactjs.org` to go into the project root
1. `yarn` to install the website's NPM dependencies

### Running locally

1. `yarn dev` to start the hot-reloading development server (powered by [Gatsby](https://www.gatsbyjs.org))
1. `open http://localhost:8000` to open the site in your favorite browser

## Contributing

### Create a branch

1. `git checkout master` from any folder in your local react repository
1. `git pull origin master` to ensure you have the latest main code
1. `git checkout -b the-name-of-my-branch` (replacing `the-name-of-my-branch` with a suitable name) to create a branch

### Make the change

1. Follow the "Running locally" instructions
1. Save the files and check in the browser
1. Changes to React components in `src` will hot-reload
1. Changes to markdown files in `content` will hot-reload
1. If working with plugins, you may need to remove the `.cache` directory and restart the server

### Test the change

1. If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
1. Run `yarn check-all` from the project root. (This will run Prettier, ESlint, and Flow.)

### Push it

1. `git add -A && git commit -m "My message"` (replacing `My message` with a commit message, such as `Fixed header logo on Android`) to stage and commit your changes
1. `git push my-fork-name the-name-of-my-branch`
1. Go to the [reactjs.org repo](https://github.com/facebook/reactjs.org) and you should see recently pushed branches.
1. Follow GitHub's instructions.
1. If possible include screenshots of visual changes. A Netlify build will also be automatically created once you make your PR so other people can see your change.

## Troubleshooting

- `yarn reset` to clear the local cache
3 changes: 3 additions & 0 deletions flow-typed/hex2rgba.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'hex2rgba' {
declare module.exports: (hex : string, alpha? : number) => string;
}
142 changes: 142 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/

'use strict';

module.exports = {
siteMetadata: {
title: 'React: A JavaScript library for building user interfaces',
siteUrl: 'https://reactjs.org',
rssFeedTitle: 'React',
rssFeedDescription: 'A JavaScript library for building user interfaces',
},
mapping: {
'MarkdownRemark.frontmatter.author': 'AuthorYaml',
},
plugins: [
'gatsby-source-react-error-codes',
'gatsby-transformer-authors-yaml',
'gatsby-plugin-netlify',
'gatsby-plugin-glamor',
'gatsby-plugin-react-next',
'gatsby-plugin-twitter',
{
resolve: 'gatsby-plugin-nprogress',
options: {
color: '#61dafb',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/pages`,
name: 'pages',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'packages',
path: `${__dirname}/content/`,
},
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-responsive-iframe',
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 840,
},
},
'gatsby-remark-autolink-headers',
'gatsby-remark-use-jsx',
{
resolve: 'gatsby-remark-prismjs',
options: {
classPrefix: 'gatsby-code-',
},
},
'gatsby-remark-copy-linked-files',
'gatsby-remark-smartypants',
],
},
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: 'UA-41298772-1',
},
},
{
resolve: 'gatsby-plugin-feed',
options: {
query: `
{
site {
siteMetadata {
title: rssFeedTitle
description: rssFeedDescription
siteUrl
site_url: siteUrl
}
}
}`,
feeds: [
{
serialize: ({query: {site, allMarkdownRemark}}) => {
return allMarkdownRemark.edges.map(edge => {
return Object.assign(
{},
{
title: edge.node.frontmatter.title,
description: edge.node.html,
date: require('moment')(edge.node.fields.date).format(
'MMMM DD, YYYY, h:mm A',
),
url: site.siteMetadata.siteUrl + edge.node.fields.slug,
guid: site.siteMetadata.siteUrl + edge.node.fields.slug,
},
);
});
},
query: `
{
allMarkdownRemark
(limit: 10,
filter: {id: {regex: "/blog/"}},
sort: {fields: [fields___date],
order: DESC}) {
edges {
node {
fields {
date
slug
}
frontmatter {
title
}
html
}
}
}
}
`,
output: '/feed.xml',
},
],
},
},
'gatsby-plugin-react-helmet',
],
};
Loading

0 comments on commit 9d9b202

Please sign in to comment.